From 9243a5ffaa67c1fd77a0c77e656416646989f9e8 Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Wed, 27 Apr 2022 20:40:45 +0000 Subject: Use closest form when copy image from clipboard (#36817). Patch by Yazan Al aeddin. git-svn-id: https://svn.redmine.org/redmine/trunk@21540 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- public/javascripts/attachments.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'public') diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js index 76d75d6e2..b7c42aa8a 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -289,7 +289,8 @@ function copyImageFromClipboard(e) { + '-' + randomKey(5).toLocaleLowerCase() + '.' + file.name.split('.').pop(); - var inputEl = $('input:file.filedrop').first() + // get input file in the closest form + var inputEl = $(this).closest("form").find('input:file.filedrop'); handleFileDropEvent.target = e.target; addFile(inputEl, new File([file], filename, { type: file.type }), true); } -- cgit v1.2.3