mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 03:01:54 +00:00
[Accessibility] Use keybindings to add keybindings (#2384)
This commit is contained in:
@@ -213,6 +213,17 @@ function removeKeybinding(commandData: ICommandData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function captureKeybinding(event: KeyboardEvent) {
|
function captureKeybinding(event: KeyboardEvent) {
|
||||||
|
// Allow the use of keyboard shortcuts when adding keyboard shortcuts
|
||||||
|
if (!event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey) {
|
||||||
|
switch (event.key) {
|
||||||
|
case 'Escape':
|
||||||
|
cancelEdit()
|
||||||
|
return
|
||||||
|
case 'Enter':
|
||||||
|
saveKeybinding()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
const keyCombo = KeyComboImpl.fromEvent(event)
|
const keyCombo = KeyComboImpl.fromEvent(event)
|
||||||
newBindingKeyCombo.value = keyCombo
|
newBindingKeyCombo.value = keyCombo
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user