mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
fix prompt drag/drop
This commit is contained in:
@@ -9,16 +9,15 @@ async function initDragDrop() {
|
||||
if (!target.placeholder) return;
|
||||
if (target.placeholder.indexOf('Prompt') === -1) return;
|
||||
const promptTarget = get_tab_index('tabs') === 1 ? 'img2img_prompt_image' : 'txt2img_prompt_image';
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
const imgParent = gradioApp().getElementById(promptTarget);
|
||||
if (!imgParent) return;
|
||||
const { files } = e.dataTransfer;
|
||||
const fileInput = imgParent.querySelector('input[type="file"]');
|
||||
if (fileInput) {
|
||||
fileInput.files = files;
|
||||
if (!imgParent || !fileInput) return;
|
||||
if ((e.dataTransfer?.files?.length || 0) > 0) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
fileInput.files = e.dataTransfer.files;
|
||||
fileInput.dispatchEvent(new Event('change'));
|
||||
log('dropEvent');
|
||||
log('dropEvent files', fileInput.files);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user