fix drop image to prompt in modernui

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-09-08 09:42:22 -04:00
parent f5109657b1
commit d673c58c10
11 changed files with 23 additions and 19 deletions
+3 -7
View File
@@ -4,14 +4,10 @@ async function initDragDrop() {
const target = e.composedPath()[0];
if (!target.placeholder) return;
if (target.placeholder.indexOf('Prompt') === -1) return;
const tab = get_tab_index('tabs');
let promptTarget = '';
if (tab === 0) promptTarget = 'txt2img_prompt_image';
else if (tab === 1) promptTarget = 'img2img_prompt_image';
else if (tab === 2) promptTarget = 'control_prompt_image';
else if (tab === 3) promptTarget = 'video_prompt_image';
else return;
const tabName = getENActiveTab();
const promptTarget = `${tabName}_prompt_image`;
const imgParent = gradioApp().getElementById(promptTarget);
log('dropEvent', target, promptTarget, imgParent);
const fileInput = imgParent.querySelector('input[type="file"]');
if (!imgParent || !fileInput) return;
if ((e.dataTransfer?.files?.length || 0) > 0) {