Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
d6a3c0d4
Commit
d6a3c0d4
authored
Apr 12, 2023
by
pythongosssss
Browse files
Add support for dropping images from urls
parent
f15b4a7f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
web/scripts/app.js
web/scripts/app.js
+14
-2
No files found.
web/scripts/app.js
View file @
d6a3c0d4
...
@@ -362,8 +362,20 @@ class ComfyApp {
...
@@ -362,8 +362,20 @@ class ComfyApp {
if
(
n
&&
n
.
onDragDrop
&&
(
await
n
.
onDragDrop
(
event
)))
{
if
(
n
&&
n
.
onDragDrop
&&
(
await
n
.
onDragDrop
(
event
)))
{
return
;
return
;
}
}
// Dragging from Chrome->Firefox there is a file but its a bmp, so ignore that
if
(
event
.
dataTransfer
.
files
.
length
&&
event
.
dataTransfer
.
files
[
0
].
type
!==
"
image/bmp
"
)
{
await
this
.
handleFile
(
event
.
dataTransfer
.
files
[
0
]);
await
this
.
handleFile
(
event
.
dataTransfer
.
files
[
0
]);
}
else
{
// Try loading the first URI in the transfer list
const
validTypes
=
[
"
text/uri-list
"
,
"
text/x-moz-url
"
];
const
match
=
[...
event
.
dataTransfer
.
types
].
find
((
t
)
=>
validTypes
.
find
(
v
=>
t
===
v
));
if
(
match
)
{
const
uri
=
event
.
dataTransfer
.
getData
(
match
)?.
split
(
"
\n
"
)?.[
0
];
if
(
uri
)
{
await
this
.
handleFile
(
await
(
await
fetch
(
uri
)).
blob
());
}
}
}
});
});
// Always clear over node on drag leave
// Always clear over node on drag leave
...
@@ -1090,7 +1102,7 @@ class ComfyApp {
...
@@ -1090,7 +1102,7 @@ class ComfyApp {
importA1111
(
this
.
graph
,
pngInfo
.
parameters
);
importA1111
(
this
.
graph
,
pngInfo
.
parameters
);
}
}
}
}
}
else
if
(
file
.
type
===
"
application/json
"
||
file
.
name
.
endsWith
(
"
.json
"
))
{
}
else
if
(
file
.
type
===
"
application/json
"
||
file
.
name
?
.
endsWith
(
"
.json
"
))
{
const
reader
=
new
FileReader
();
const
reader
=
new
FileReader
();
reader
.
onload
=
()
=>
{
reader
.
onload
=
()
=>
{
this
.
loadGraphData
(
JSON
.
parse
(
reader
.
result
));
this
.
loadGraphData
(
JSON
.
parse
(
reader
.
result
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment