diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2022-03-22 06:58:20 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2022-03-22 06:58:20 +0000 |
commit | eb03ee3cda8d1a6c9a10bd7e2db2e13d26e20dc5 (patch) | |
tree | c86e830bee6cd33000e93d46c24be4fe188b7a2c | |
parent | eaa858265199c649bb4aa9c104275ea201b19e8d (diff) | |
download | redmine-eb03ee3cda8d1a6c9a10bd7e2db2e13d26e20dc5.tar.gz redmine-eb03ee3cda8d1a6c9a10bd7e2db2e13d26e20dc5.zip |
Merged r21463 to 4.1-stable (#36013).
git-svn-id: https://svn.redmine.org/redmine/branches/4.1-stable@21494 e93f8b46-1217-0410-a6f0-8f06a7374b81
-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 f5d2f727b..b5173c067 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -259,11 +259,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() @@ -272,9 +271,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); |