mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-01 19:20:10 +00:00
Fix keybinds invalidated by capslock state (#1776)
* [Refactor] Simplify keybinds code * [Refactor] Type safety * Fix capslock inverts undo/redo shortcuts * [Refactor] Type safety * Fix capslock state changes keybinds * Deprecate keybind deserialize * Remove keybind deserialize
This commit is contained in:
@@ -37,26 +37,26 @@ app.registerExtension({
|
||||
return
|
||||
}
|
||||
|
||||
// Finished Handling all modifier keybinds, now handle the rest
|
||||
// Only clear dialogs if not using modifiers
|
||||
if (event.ctrlKey || event.altKey || event.metaKey) {
|
||||
return
|
||||
}
|
||||
|
||||
// Close out of modals using escape
|
||||
// Escape key: close the first open modal found, and all dialogs
|
||||
if (event.key === 'Escape') {
|
||||
const modals = document.querySelectorAll<HTMLElement>('.comfy-modal')
|
||||
const modal = Array.from(modals).find(
|
||||
(modal) =>
|
||||
window.getComputedStyle(modal).getPropertyValue('display') !==
|
||||
'none'
|
||||
)
|
||||
if (modal) {
|
||||
modal.style.display = 'none'
|
||||
for (const modal of modals) {
|
||||
const modalDisplay = window
|
||||
.getComputedStyle(modal)
|
||||
.getPropertyValue('display')
|
||||
|
||||
if (modalDisplay !== 'none') {
|
||||
modal.style.display = 'none'
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
;[...document.querySelectorAll('dialog')].forEach((d) => {
|
||||
d.close()
|
||||
})
|
||||
for (const d of document.querySelectorAll('dialog')) d.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user