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