diff options
author | missionfloyd <missionfloyd@users.noreply.github.com> | 2023-05-22 00:17:32 +0000 |
---|---|---|
committer | missionfloyd <missionfloyd@users.noreply.github.com> | 2023-05-22 00:17:32 +0000 |
commit | a862428902c4aecde8852761c3a4d95c196885cb (patch) | |
tree | 2279f87f0c015356db85945d89bba8610fc01cf9 | |
parent | 89f9faa63388756314e8a1d96cf86bf5e0663045 (diff) | |
download | stable-diffusion-webui-gfx803-a862428902c4aecde8852761c3a4d95c196885cb.tar.gz stable-diffusion-webui-gfx803-a862428902c4aecde8852761c3a4d95c196885cb.tar.bz2 stable-diffusion-webui-gfx803-a862428902c4aecde8852761c3a4d95c196885cb.zip |
Fix dragging text to prompt
-rw-r--r-- | javascript/dragdrop.js | 4 | ||||
-rw-r--r-- | javascript/imageParams.js | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/javascript/dragdrop.js b/javascript/dragdrop.js index fe008924..90cdd507 100644 --- a/javascript/dragdrop.js +++ b/javascript/dragdrop.js @@ -51,7 +51,7 @@ function dropReplaceImage( imgWrap, files ) { window.document.addEventListener('dragover', e => { const target = e.composedPath()[0]; const imgWrap = target.closest('[data-testid="image"]'); - if ( !imgWrap && target.placeholder && target.placeholder.indexOf("Prompt") == -1) { + if (e.dataTransfer.files.length == 0 || (!imgWrap && target.placeholder && target.placeholder.indexOf("Prompt") == -1)) { return; } e.stopPropagation(); @@ -61,7 +61,7 @@ window.document.addEventListener('dragover', e => { window.document.addEventListener('drop', e => { const target = e.composedPath()[0]; - if (target.placeholder.indexOf("Prompt") == -1) { + if (e.dataTransfer.files.length == 0 || target.placeholder.indexOf("Prompt") == -1) { return; } const imgWrap = target.closest('[data-testid="image"]'); 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"; |