mirror of
https://github.com/gchq/CyberChef
synced 2026-02-27 18:13:17 +00:00
Paste spreadsheets as text (#2200)
This commit is contained in:
committed by
GitHub
parent
d71dad8568
commit
98fb680a92
@@ -153,16 +153,22 @@ class InputWaiter {
|
||||
paste(event, view) {
|
||||
const clipboardData = event.clipboardData;
|
||||
const items = clipboardData.items;
|
||||
const files = [];
|
||||
let files = [];
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const item = items[i];
|
||||
if (item.kind === "file") {
|
||||
const file = item.getAsFile();
|
||||
files.push(file);
|
||||
|
||||
event.preventDefault(); // Prevent the default paste behavior
|
||||
if (item.kind === "string") {
|
||||
// If there are any string items they should be preferred over
|
||||
// files.
|
||||
files = [];
|
||||
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(() => {
|
||||
self.afterPaste(files);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user