mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Fix JS error when pasting data with merged cells.
Summary: Pasting data with merged cells from Excel (or from HTML tables with colspan/rowspan), we used to get "Cannot read property 'displayValue' of undefined". Fix it by assuming that some cell values may be empty. Test Plan: Added test case reproduces the failure without the fix, and passes with. Reviewers: alexmojaki Reviewed By: alexmojaki Differential Revision: https://phab.getgrist.com/D2990
This commit is contained in:
parent
00c1a0c688
commit
572b59cc0c
@ -369,9 +369,9 @@ BaseView.prototype._parsePasteForView = function(data, cols) {
|
||||
_.isObject(data[0][0]) && data[0][0].hasOwnProperty('displayValue')) {
|
||||
richData = data.map((col, idx) => {
|
||||
if (col[0].colType === updateColTypes[idx]) {
|
||||
return col.map(v => v.hasOwnProperty('rawValue') ? v.rawValue : v.displayValue);
|
||||
return col.map(v => v && v.hasOwnProperty('rawValue') ? v.rawValue : v.displayValue);
|
||||
} else {
|
||||
return col.map(v => v.displayValue);
|
||||
return col.map(v => v && v.displayValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user