Skip to content

Commit

Permalink
Merge pull request #26 from juliushaertl/paste-image
Browse files Browse the repository at this point in the history
Allow pasting files from the clipboard
  • Loading branch information
rullzer authored Oct 23, 2019
2 parents ad125e9 + 3c36b48 commit 3455043
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion js/drop.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$(document).ready(function() {

new Dropzone(
var dropzone = new Dropzone(
'#app-content-dropit .drop-area', {
uploadMultiple: false,
createImageThumbnails: false,
Expand All @@ -25,6 +25,16 @@ $(document).ready(function() {
}
);

document.onpaste = function(event){
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
for (index in items) {
var item = items[index];
if (item.kind === 'file') {
dropzone.addFile(item.getAsFile())
}
}
}

new Clipboard('#app-content-dropit .copyButton');

$('#app-content-dropit .text-submit').on('click', function() {
Expand Down

0 comments on commit 3455043

Please sign in to comment.