MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / onKey

Function onKey

packages/app-core/src/components/SettingsModal.tsx:984–991  ·  view source on GitHub ↗
(e: KeyboardEvent)

Source from the content-addressed store, hash-verified

982
983 useEffect(() => {
984 const onKey = (e: KeyboardEvent): void => {
985 // Don't close Settings on Esc while a nested editor/modal is open —
986 // that would discard in-progress work (e.g. a template draft). Those
987 // modals handle Esc themselves (Vim normal mode, etc.).
988 if (e.key === 'Escape' && !templateEditor && !editingRemoteProfile) {
989 setSettingsOpen(false)
990 }
991 }
992 window.addEventListener('keydown', onKey)
993 return () => window.removeEventListener('keydown', onKey)
994 }, [setSettingsOpen, templateEditor, editingRemoteProfile])

Callers

nothing calls this directly

Calls 3

shortcutBindingFromEventFunction · 0.90
sequenceTokenFromEventFunction · 0.90
toElectronAcceleratorFunction · 0.85

Tested by

no test coverage detected