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
186f9204
Commit
186f9204
authored
Jun 20, 2023
by
comfyanonymous
Browse files
Merge branch 'improve-keyboard' of
https://github.com/reaper47/ComfyUI
parents
036a2207
96e8307b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
29 deletions
+26
-29
web/extensions/core/colorPalette.js
web/extensions/core/colorPalette.js
+1
-1
web/extensions/core/keybinds.js
web/extensions/core/keybinds.js
+21
-27
web/scripts/ui.js
web/scripts/ui.js
+4
-1
No files found.
web/extensions/core/colorPalette.js
View file @
186f9204
...
...
@@ -435,7 +435,7 @@ app.registerExtension({
$el
(
"
td
"
,
[
$el
(
"
label
"
,
{
for
:
id
.
replaceAll
(
"
.
"
,
"
-
"
),
textContent
:
"
Color palette
:
"
,
textContent
:
"
Color palette
"
,
}),
]),
$el
(
"
td
"
,
[
...
...
web/extensions/core/keybinds.js
View file @
186f9204
import
{
app
}
from
"
/scripts/app.js
"
;
import
{
app
}
from
"
/scripts/app.js
"
;
const
id
=
"
Comfy.Keybinds
"
;
app
.
registerExtension
({
name
:
id
,
name
:
"
Comfy.Keybinds
"
,
init
()
{
const
keybindListener
=
function
(
event
)
{
const
keybindListener
=
function
(
event
)
{
const
modifierPressed
=
event
.
ctrlKey
||
event
.
metaKey
;
// Queue prompt using ctrl or command + enter
if
(
modifierPressed
&&
(
event
.
key
===
"
Enter
"
||
event
.
keyCode
===
13
||
event
.
keyCode
===
10
)
)
{
app
.
queuePrompt
(
event
.
shiftKey
?
-
1
:
0
);
if
(
modifierPressed
&&
event
.
key
===
"
Enter
"
)
{
app
.
queuePrompt
(
event
.
shiftKey
?
-
1
:
0
)
.
then
()
;
return
;
}
const
target
=
event
.
composedPath
()[
0
];
if
(
target
.
tagName
===
"
INPUT
"
||
target
.
tagName
===
"
TEXTAREA
"
)
{
if
([
"
INPUT
"
,
"
TEXTAREA
"
].
includes
(
target
.
tagName
))
{
return
;
}
const
modifierKeyIdMap
=
{
"
s
"
:
"
#comfy-save-button
"
,
83
:
"
#comfy-save-button
"
,
"
o
"
:
"
#comfy-file-input
"
,
79
:
"
#comfy-file-input
"
,
"
Backspace
"
:
"
#comfy-clear-button
"
,
8
:
"
#comfy-clear-button
"
,
"
Delete
"
:
"
#comfy-clear-button
"
,
46
:
"
#comfy-clear-button
"
,
"
d
"
:
"
#comfy-load-default-button
"
,
68
:
"
#comfy-load-default-button
"
,
s
:
"
#comfy-save-button
"
,
o
:
"
#comfy-file-input
"
,
Backspace
:
"
#comfy-clear-button
"
,
Delete
:
"
#comfy-clear-button
"
,
d
:
"
#comfy-load-default-button
"
,
};
const
modifierKeybindId
=
modifierKeyIdMap
[
event
.
key
]
||
modifierKeyIdMap
[
event
.
keyCode
]
;
const
modifierKeybindId
=
modifierKeyIdMap
[
event
.
key
];
if
(
modifierPressed
&&
modifierKeybindId
)
{
event
.
preventDefault
();
...
...
@@ -47,24 +40,25 @@ app.registerExtension({
}
// Close out of modals using escape
if
(
event
.
key
===
"
Escape
"
||
event
.
keyCode
===
27
)
{
if
(
event
.
key
===
"
Escape
"
)
{
const
modals
=
document
.
querySelectorAll
(
"
.comfy-modal
"
);
const
modal
=
Array
.
from
(
modals
).
find
(
modal
=>
window
.
getComputedStyle
(
modal
).
getPropertyValue
(
"
display
"
)
!==
"
none
"
);
if
(
modal
)
{
modal
.
style
.
display
=
"
none
"
;
}
[...
document
.
querySelectorAll
(
"
dialog
"
)].
forEach
(
d
=>
{
d
.
close
();
});
}
const
keyIdMap
=
{
"
q
"
:
"
#comfy-view-queue-button
"
,
81
:
"
#comfy-view-queue-button
"
,
"
h
"
:
"
#comfy-view-history-button
"
,
72
:
"
#comfy-view-history-button
"
,
"
r
"
:
"
#comfy-refresh-button
"
,
82
:
"
#comfy-refresh-button
"
,
q
:
"
#comfy-view-queue-button
"
,
h
:
"
#comfy-view-history-button
"
,
r
:
"
#comfy-refresh-button
"
,
};
const
buttonId
=
keyIdMap
[
event
.
key
]
||
keyIdMap
[
event
.
keyCode
]
;
const
buttonId
=
keyIdMap
[
event
.
key
];
if
(
buttonId
)
{
const
button
=
document
.
querySelector
(
buttonId
);
button
.
click
();
...
...
web/scripts/ui.js
View file @
186f9204
...
...
@@ -211,6 +211,9 @@ class ComfySettingsDialog extends ComfyDialog {
$el
(
"
button
"
,
{
type
:
"
button
"
,
textContent
:
"
Close
"
,
style
:
{
cursor
:
"
pointer
"
,
},
onclick
:
()
=>
{
this
.
element
.
close
();
},
...
...
@@ -267,7 +270,7 @@ class ComfySettingsDialog extends ComfyDialog {
$el
(
"
label
"
,
{
for
:
htmlID
,
classList
:
[
tooltip
!==
""
?
"
comfy-tooltip-indicator
"
:
""
],
textContent
:
name
.
endsWith
(
"
:
"
)
?
name
:
`
${
name
}
:`
,
textContent
:
name
,
})
]);
...
...
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