| 166 | '--tsrd-font-size', |
| 167 | getComputedStyle(element).fontSize, |
| 168 | ) |
| 169 | } |
| 170 | }) |
| 171 | const isEditableTarget = (element: Element | null) => { |
| 172 | if (!element || !(element instanceof HTMLElement)) return false |
| 173 | if (element.isContentEditable) return true |
| 174 | if (['INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName)) return true |
| 175 | return element.getAttribute('role') === 'textbox' |
| 176 | } |
| 177 | // A memo owns what it creates, so changing the hotkey disposes the old |
| 178 | // shortcuts before registering the new ones. |
| 179 | createMemo(() => { |
| 180 | for (const permutation of getHotkeyPermutations(settings().openHotkey)) { |
| 181 | createShortcut(permutation, () => { |
| 182 | if (!hiddenInAutomation() && !isEditableTarget(document.activeElement)) |
| 183 | toggleOpen() |