fup: allow for pasting text content from clipboard
This commit is contained in:
parent
6e539188ac
commit
fa086419c8
1 changed files with 8 additions and 0 deletions
|
@ -153,6 +153,14 @@ if (document.body.classList.contains('upload-page')) {
|
|||
for (const item of clipboardData.items) {
|
||||
if (item.kind === 'file') {
|
||||
uploadFile(item.getAsFile(), expiryEl.value);
|
||||
} else if (item.kind === 'string') {
|
||||
item.getAsString((data) => {
|
||||
// This is a hack, we should do something... more sensible.
|
||||
const uploadData = new Blob([data], { type: 'text/plain' });
|
||||
uploadData.name = 'clipboard.txt';
|
||||
|
||||
uploadFile(uploadData, expiryEl.value);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue