mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-05-02 14:36:08 -04:00
Added possibility to paste an image from the clipboard
This commit is contained in:
parent
838ca3d38e
commit
24aea957b3
4 changed files with 23 additions and 5 deletions
|
@ -2298,6 +2298,23 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Attaches the clipboard attachment handler to the page.
|
||||
* @returns {undefined}
|
||||
*/
|
||||
me.addClipboardEventHandler = function () {
|
||||
document.addEventListener("paste",
|
||||
function (event) {
|
||||
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
|
||||
for (var i in items) {
|
||||
var item = items[i];
|
||||
if (item.kind === 'file') {
|
||||
me.readFileData(item.getAsFile());
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
};
|
||||
|
||||
/**
|
||||
* initiate
|
||||
*
|
||||
|
@ -2315,6 +2332,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
|
|||
|
||||
me.$fileInput = $('#file');
|
||||
me.addDragDropHandler();
|
||||
me.addClipboardEventHandler();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue