diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-09-08 07:31:20 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-09-08 07:31:20 +0000 |
commit | 61785cef656335cce3ab50b420301d2821f7c5e1 (patch) | |
tree | df66e649b5e30c21fb68d6b93af9bb48b0f48584 /script.js | |
parent | 0fedd50886fb2f745cc6faab001090b77fbd0382 (diff) | |
parent | 9ddaf8269ebfb11c8fd2e48f0e8d33c125213437 (diff) | |
download | stable-diffusion-webui-gfx803-61785cef656335cce3ab50b420301d2821f7c5e1.tar.gz stable-diffusion-webui-gfx803-61785cef656335cce3ab50b420301d2821f7c5e1.tar.bz2 stable-diffusion-webui-gfx803-61785cef656335cce3ab50b420301d2821f7c5e1.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'script.js')
-rw-r--r-- | script.js | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -172,3 +172,19 @@ function submit(){ } return res } + +window.addEventListener('paste', e => { + const files = e.clipboardData.files; + if (!files || files.length !== 1) { + return; + } + if (!['image/png', 'image/gif', 'image/jpeg'].includes(files[0].type)) { + return; + } + [...gradioApp().querySelectorAll('input[type=file][accept="image/x-png,image/gif,image/jpeg"]')] + .filter(input => !input.matches('.\\!hidden input[type=file]')) + .forEach(input => { + input.files = files; + input.dispatchEvent(new Event('change')) + }); +}); |