diff options
-rw-r--r-- | public/javascripts/attachments.js | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js index 9380d1274..3155362fc 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -275,11 +275,10 @@ function copyImageFromClipboard(e) { if (!clipboardData) { return; } if (clipboardData.types.some(function(t){ return /^text\/plain$/.test(t); })) { return; } - var items = clipboardData.items - for (var i = 0 ; i < items.length ; i++) { - var item = items[i]; - if (item.type.indexOf("image") != -1) { - var blob = item.getAsFile(); + var files = clipboardData.files + for (var i = 0 ; i < files.length ; i++) { + var file = files[i]; + if (file.type.indexOf("image") != -1) { var date = new Date(); var filename = 'clipboard-' + date.getFullYear() @@ -288,9 +287,8 @@ function copyImageFromClipboard(e) { + ('0'+date.getHours()).slice(-2) + ('0'+date.getMinutes()).slice(-2) + '-' + randomKey(5).toLocaleLowerCase() - + '.' + blob.name.split('.').pop(); - var file = new Blob([blob], {type: blob.type}); - file.name = filename; + + '.' + file.name.split('.').pop(); + var inputEl = $('input:file.filedrop').first() handleFileDropEvent.target = e.target; addFile(inputEl, file, true); |