MCPcopy Create free account
hub / github.com/pingdotgg/t3code / keybindingValueForCommand

Function keybindingValueForCommand

apps/web/src/lib/projectScriptKeybindings.ts:37–61  ·  view source on GitHub ↗
(
  keybindings: ResolvedKeybindingsConfig,
  command: KeybindingCommand,
)

Source from the content-addressed store, hash-verified

35}
36
37export function keybindingValueForCommand(
38 keybindings: ResolvedKeybindingsConfig,
39 command: KeybindingCommand,
40): string | null {
41 for (let index = keybindings.length - 1; index >= 0; index -= 1) {
42 const binding = keybindings[index];
43 if (!binding || binding.command !== command) continue;
44
45 const parts: string[] = [];
46 if (binding.shortcut.modKey) parts.push("mod");
47 if (binding.shortcut.ctrlKey) parts.push("ctrl");
48 if (binding.shortcut.metaKey) parts.push("meta");
49 if (binding.shortcut.altKey) parts.push("alt");
50 if (binding.shortcut.shiftKey) parts.push("shift");
51 const keyToken =
52 binding.shortcut.key === " "
53 ? "space"
54 : binding.shortcut.key === "escape"
55 ? "esc"
56 : binding.shortcut.key;
57 parts.push(keyToken);
58 return parts.join("+");
59 }
60 return null;
61}

Callers 2

openEditDialogFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected