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
623afa2c
Commit
623afa2c
authored
Apr 05, 2023
by
pythongosssss
Browse files
Made accessing setting value easier
Updated clear check to use this
parent
30f274bf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
web/scripts/ui.js
web/scripts/ui.js
+19
-10
No files found.
web/scripts/ui.js
View file @
623afa2c
...
@@ -115,14 +115,6 @@ function dragElement(dragEl, settings) {
...
@@ -115,14 +115,6 @@ function dragElement(dragEl, settings) {
savePos
=
value
;
savePos
=
value
;
},
},
});
});
settings
.
addSetting
({
id
:
"
Comfy.ConfirmClear
"
,
name
:
"
Require confirmation when clearing workflow
"
,
type
:
"
boolean
"
,
defaultValue
:
true
,
});
function
dragMouseDown
(
e
)
{
function
dragMouseDown
(
e
)
{
e
=
e
||
window
.
event
;
e
=
e
||
window
.
event
;
e
.
preventDefault
();
e
.
preventDefault
();
...
@@ -289,6 +281,16 @@ class ComfySettingsDialog extends ComfyDialog {
...
@@ -289,6 +281,16 @@ class ComfySettingsDialog extends ComfyDialog {
return
element
;
return
element
;
},
},
});
});
const
self
=
this
;
return
{
get
value
()
{
return
self
.
getSettingValue
(
id
);
},
set
value
(
v
)
{
self
.
setSettingValue
(
id
,
value
);
},
};
}
}
show
()
{
show
()
{
...
@@ -410,6 +412,13 @@ export class ComfyUI {
...
@@ -410,6 +412,13 @@ export class ComfyUI {
this
.
history
.
update
();
this
.
history
.
update
();
});
});
const
confirmClear
=
this
.
settings
.
addSetting
({
id
:
"
Comfy.ConfirmClear
"
,
name
:
"
Require confirmation when clearing workflow
"
,
type
:
"
boolean
"
,
defaultValue
:
true
,
});
const
fileInput
=
$el
(
"
input
"
,
{
const
fileInput
=
$el
(
"
input
"
,
{
type
:
"
file
"
,
type
:
"
file
"
,
accept
:
"
.json,image/png
"
,
accept
:
"
.json,image/png
"
,
...
@@ -517,13 +526,13 @@ export class ComfyUI {
...
@@ -517,13 +526,13 @@ export class ComfyUI {
$el
(
"
button
"
,
{
textContent
:
"
Load
"
,
onclick
:
()
=>
fileInput
.
click
()
}),
$el
(
"
button
"
,
{
textContent
:
"
Load
"
,
onclick
:
()
=>
fileInput
.
click
()
}),
$el
(
"
button
"
,
{
textContent
:
"
Refresh
"
,
onclick
:
()
=>
app
.
refreshComboInNodes
()
}),
$el
(
"
button
"
,
{
textContent
:
"
Refresh
"
,
onclick
:
()
=>
app
.
refreshComboInNodes
()
}),
$el
(
"
button
"
,
{
textContent
:
"
Clear
"
,
onclick
:
()
=>
{
$el
(
"
button
"
,
{
textContent
:
"
Clear
"
,
onclick
:
()
=>
{
if
(
localStorage
.
getItem
(
"
Comfy.Settings.Comfy.ConfirmClear
"
)
==
"
false
"
||
confirm
(
"
Clear workflow?
"
))
{
if
(
!
confirmClear
.
value
||
confirm
(
"
Clear workflow?
"
))
{
app
.
clean
();
app
.
clean
();
app
.
graph
.
clear
();
app
.
graph
.
clear
();
}
}
}}),
}}),
$el
(
"
button
"
,
{
textContent
:
"
Load Default
"
,
onclick
:
()
=>
{
$el
(
"
button
"
,
{
textContent
:
"
Load Default
"
,
onclick
:
()
=>
{
if
(
localStorage
.
getItem
(
"
Comfy.Settings.Comfy.ConfirmClear
"
)
==
"
false
"
||
confirm
(
"
Load default workflow?
"
))
{
if
(
!
confirmClear
.
value
||
confirm
(
"
Load default workflow?
"
))
{
app
.
loadGraphData
()
app
.
loadGraphData
()
}
}
}}),
}}),
...
...
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