(keybinds: Keybind[], event: KeyboardEvent)
| 153 | } |
| 154 | |
| 155 | export function matchKeybind(keybinds: Keybind[], event: KeyboardEvent): boolean { |
| 156 | const eventKey = normalizeKey(event.key) |
| 157 | |
| 158 | for (const kb of keybinds) { |
| 159 | const keyMatch = kb.key === eventKey |
| 160 | const ctrlMatch = kb.ctrl === (event.ctrlKey || false) |
| 161 | const metaMatch = kb.meta === (event.metaKey || false) |
| 162 | const shiftMatch = kb.shift === (event.shiftKey || false) |
| 163 | const altMatch = kb.alt === (event.altKey || false) |
| 164 | |
| 165 | if (keyMatch && ctrlMatch && metaMatch && shiftMatch && altMatch) { |
| 166 | return true |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | return false |
| 171 | } |
| 172 | |
| 173 | function displayKeybindParts(kb: Keybind, t?: (key: KeyLabel) => string) { |
| 174 | const parts: string[] = [] |
no test coverage detected