Open SheetJSDev opened 2 years ago
I have encountered the same problem. Any update?
Looks like the script in /docs/xspreadsheet.js
is an older build.
pasteFromText
is defined in the site script as follows (passed through prettier):
{
key: "pasteFromText",
value: function (t) {
var e = t.split("\r\n").map(function (t) {
return t.replace(/"/g, "").split("\t");
});
e.length > 0 && (e.length -= 1); // <-- this removes the last line
var n = this.rows,
r = this.selector;
this.changeData(function () {
n.paste(e, r.range);
});
},
}
The line that decrements the array length was removed in 8074c79e01cb510c80f41d2e0f911187e37dc710 (September 21) so the bundled version in the docs
folder just needs a refresh.
Tested in Chromium and Safari against https://myliang.github.io/x-spreadsheet/
After copying plain text, pasting (either with context menu or Command+V) does not paste any content. It does paste text if you activate the cell editor.
After copying a region of cells in Excel:
To explain the last behavior, if you copy a region from Excel that has 3 rows and 2 columns, hitting Command+V in x-spreadsheet will write 2 rows x 2 columns. The last row is lost.