Paste spreadsheet as text

This commit is contained in:
C85297 2026-02-20 15:46:45 +00:00
parent c97baa6fdf
commit 40e5d3ac37
No known key found for this signature in database

View File

@ -153,16 +153,22 @@ class InputWaiter {
paste(event, view) { paste(event, view) {
const clipboardData = event.clipboardData; const clipboardData = event.clipboardData;
const items = clipboardData.items; const items = clipboardData.items;
const files = []; let files = [];
for (let i = 0; i < items.length; i++) { for (let i = 0; i < items.length; i++) {
const item = items[i]; const item = items[i];
if (item.kind === "file") { if (item.kind === "string") {
const file = item.getAsFile(); // If there are any string items they should be preferred over
files.push(file); // files.
files = [];
event.preventDefault(); // Prevent the default paste behavior break;
} else if (item.kind === "file") {
files.push(item.getAsFile());
} }
} }
if (files.length > 0) {
// Prevent the default paste behavior, afterPaste will load the files instead
event.preventDefault();
}
setTimeout(() => { setTimeout(() => {
self.afterPaste(files); self.afterPaste(files);
}); });