MCPcopy Create free account
hub / github.com/TanStack/devtools / handleKeyInput

Function handleKeyInput

packages/devtools/src/tabs/hotkey-config.tsx:47–66  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

45
46 const handleKeyInput = (input: string) => {
47 const makeModifierArray = (key: string) => {
48 if (key.length === 1) return [uppercaseFirstLetter(key)]
49 const modifiersArray: Array<string> = []
50 for (const character of key) {
51 const newLetter = uppercaseFirstLetter(character)
52 if (!modifiersArray.includes(newLetter)) modifiersArray.push(newLetter)
53 }
54 return modifiersArray
55 }
56
57 const hotkeyModifiers = props.hotkey.filter((key) =>
58 props.modifiers.includes(key as any),
59 )
60 const newKeys = input
61 .split('+')
62 .flatMap((key) => makeModifierArray(key))
63 .filter(Boolean)
64 props.onHotkeyChange([...hotkeyModifiers, ...newKeys])
65 }
66
67 const getDisplayHotkey = () => {
68 return props.hotkey.join(' + ')
69 }

Callers

nothing calls this directly

Calls 1

makeModifierArrayFunction · 0.85

Tested by

no test coverage detected