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

Function shortcutBindingFromEvent

packages/app-core/src/lib/keymaps.ts:1366–1377  ·  view source on GitHub ↗
(event: KeyboardEvent)

Source from the content-addressed store, hash-verified

1364}
1365
1366export function shortcutBindingFromEvent(event: KeyboardEvent): string | null {
1367 const mac = isMacPlatform();
1368 const resolved = resolveKeyFromEvent(event);
1369 const key = resolved ?? normalizeKeyName(event.key);
1370 if (!key) return null;
1371 const modifiers: string[] = [];
1372 if (event.ctrlKey) modifiers.push(mac ? "Ctrl" : "Mod");
1373 if (event.metaKey) modifiers.push(mac ? "Mod" : "Meta");
1374 if (event.altKey) modifiers.push("Alt");
1375 if (event.shiftKey) modifiers.push("Shift");
1376 return normalizeShortcutBinding([...modifiers, key].join("+"));
1377}
1378
1379export function sequenceTokenFromEvent(event: KeyboardEvent): string | null {
1380 const resolved = resolveKeyFromEvent(event);

Callers 3

onKeyFunction · 0.90
keymaps.test.tsFile · 0.90
matchesShortcutBindingFunction · 0.85

Calls 4

isMacPlatformFunction · 0.85
resolveKeyFromEventFunction · 0.85
normalizeKeyNameFunction · 0.85
normalizeShortcutBindingFunction · 0.85

Tested by

no test coverage detected