diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-01-04 16:56:35 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-04 16:56:35 +0000 |
commit | eeb1de4388773ba92b9920a4f64eb91add2e02ca (patch) | |
tree | 22f5d5e7417f24599a415fd64c9f1652495ce5a3 /javascript/dragdrop.js | |
parent | d85c2cb2d59f64cbb510a9e5596596de2e4f4dcc (diff) | |
parent | b7deea47eeb033052062621b0005d4321b53bff7 (diff) | |
download | stable-diffusion-webui-gfx803-eeb1de4388773ba92b9920a4f64eb91add2e02ca.tar.gz stable-diffusion-webui-gfx803-eeb1de4388773ba92b9920a4f64eb91add2e02ca.tar.bz2 stable-diffusion-webui-gfx803-eeb1de4388773ba92b9920a4f64eb91add2e02ca.zip |
Merge branch 'master' into gradient-clipping
Diffstat (limited to 'javascript/dragdrop.js')
-rw-r--r-- | javascript/dragdrop.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/javascript/dragdrop.js b/javascript/dragdrop.js index 3ed1cb3c..fe008924 100644 --- a/javascript/dragdrop.js +++ b/javascript/dragdrop.js @@ -9,11 +9,19 @@ function dropReplaceImage( imgWrap, files ) { return; } + const tmpFile = files[0]; + imgWrap.querySelector('.modify-upload button + button, .touch-none + div button + button')?.click(); const callback = () => { const fileInput = imgWrap.querySelector('input[type="file"]'); if ( fileInput ) { - fileInput.files = files; + if ( files.length === 0 ) { + files = new DataTransfer(); + files.items.add(tmpFile); + fileInput.files = files.files; + } else { + fileInput.files = files; + } fileInput.dispatchEvent(new Event('change')); } }; |