mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-07-20 21:49:04 -04:00
Fixed adding attachments from clipboard
This commit is contained in:
parent
e38b88c12c
commit
0ce8627561
2 changed files with 11 additions and 10 deletions
|
@ -3421,16 +3421,17 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
function addClipboardEventHandler() {
|
||||
$(document).on('paste', function (event) {
|
||||
const items = (event.clipboardData || event.originalEvent.clipboardData).items;
|
||||
const lastItem = items[items.length - 1];
|
||||
if (lastItem.kind === 'file') {
|
||||
if (TopNav.isAttachmentReadonly()) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return false;
|
||||
} else {
|
||||
readFileData(lastItem.getAsFile());
|
||||
}
|
||||
const files = [...items]
|
||||
.filter(item => item.kind === 'file')
|
||||
.map(item => item.getAsFile());
|
||||
|
||||
if (TopNav.isAttachmentReadonly()) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
readFileData(files);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue