fup: add paste handler for uploading things from the clipboard
This commit is contained in:
parent
017458ae2e
commit
6e539188ac
1 changed files with 9 additions and 0 deletions
|
@ -147,4 +147,13 @@ if (document.body.classList.contains('upload-page')) {
|
|||
uploadFile(f, expiryEl.value);
|
||||
}
|
||||
}, false);
|
||||
document.body.addEventListener('paste', (e) => {
|
||||
e.preventDefault();
|
||||
const clipboardData = e.clipboardData || window.clipboardData;
|
||||
for (const item of clipboardData.items) {
|
||||
if (item.kind === 'file') {
|
||||
uploadFile(item.getAsFile(), expiryEl.value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue