From a862428902c4aecde8852761c3a4d95c196885cb Mon Sep 17 00:00:00 2001 From: missionfloyd Date: Sun, 21 May 2023 18:17:32 -0600 Subject: Fix dragging text to prompt --- javascript/imageParams.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'javascript/imageParams.js') diff --git a/javascript/imageParams.js b/javascript/imageParams.js index 64aee93b..ed0df939 100644 --- a/javascript/imageParams.js +++ b/javascript/imageParams.js @@ -1,7 +1,7 @@ window.onload = (function(){ window.addEventListener('drop', e => { const target = e.composedPath()[0]; - if (target.placeholder.indexOf("Prompt") == -1) return; + if (e.dataTransfer.files.length == 0 || target.placeholder.indexOf("Prompt") == -1) return; let prompt_target = get_tab_index('tabs') == 1 ? "img2img_prompt_image" : "txt2img_prompt_image"; -- cgit v1.2.1 From ee65e729319e4184fc0d49552657e98aa0e28f17 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Mon, 22 May 2023 09:49:51 +0300 Subject: repair file paste for Firefox from #10615 remove animation when pasting files into prompt rework two dragdrop js files into one --- javascript/imageParams.js | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 javascript/imageParams.js (limited to 'javascript/imageParams.js') diff --git a/javascript/imageParams.js b/javascript/imageParams.js deleted file mode 100644 index 0cdd717a..00000000 --- a/javascript/imageParams.js +++ /dev/null @@ -1,18 +0,0 @@ -window.onload = (function() { - window.addEventListener('drop', e => { - const target = e.composedPath()[0]; - if (e.dataTransfer.files.length == 0 || target.placeholder.indexOf("Prompt") == -1) return; - - let prompt_target = get_tab_index('tabs') == 1 ? "img2img_prompt_image" : "txt2img_prompt_image"; - - e.stopPropagation(); - e.preventDefault(); - const imgParent = gradioApp().getElementById(prompt_target); - const files = e.dataTransfer.files; - const fileInput = imgParent.querySelector('input[type="file"]'); - if (fileInput) { - fileInput.files = files; - fileInput.dispatchEvent(new Event('change')); - } - }); -}); -- cgit v1.2.1