mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-28 23:30:16 +08:00
Fix drag and drop
This commit is contained in:
parent
e4be8e0666
commit
4110e628f3
@ -444,6 +444,7 @@ const IMAGEUPLOAD = (node, inputName, inputData, app) => {
|
|||||||
|
|
||||||
const MULTIIMAGEUPLOAD = (node, inputName, inputData, app) => {
|
const MULTIIMAGEUPLOAD = (node, inputName, inputData, app) => {
|
||||||
const imagesWidget = node.addWidget("text", inputName, inputData, () => {})
|
const imagesWidget = node.addWidget("text", inputName, inputData, () => {})
|
||||||
|
imagesWidget.disabled = true;
|
||||||
|
|
||||||
imagesWidget._filepaths = []
|
imagesWidget._filepaths = []
|
||||||
if (inputData[1] && inputData[1].filepaths) {
|
if (inputData[1] && inputData[1].filepaths) {
|
||||||
@ -592,14 +593,13 @@ const MULTIIMAGEUPLOAD = (node, inputName, inputData, app) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// On drop upload files
|
// On drop upload files
|
||||||
node.onDragDrop = function (e) {
|
node.onDragDrop = async (e) => {
|
||||||
console.log("onDragDrop called");
|
console.log("onDragDrop called");
|
||||||
let handled = false;
|
let handled = false;
|
||||||
for (const file of e.dataTransfer.files) {
|
const files = Array.from(e.dataTransfer.files).filter(file => file.type.startsWith("image/"))
|
||||||
if (file.type.startsWith("image/")) {
|
if (files) {
|
||||||
uploadFile(file, !handled); // Dont await these, any order is fine, only update on first one
|
await uploadFiles(files, true);
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user