forked from FoundKeyGang/FoundKey
client: fix lints in scripts/hotkey.ts
This commit is contained in:
parent
ee46d32602
commit
2628f35012
1 changed files with 3 additions and 3 deletions
|
@ -17,7 +17,7 @@ type Action = {
|
|||
allowRepeat: boolean;
|
||||
};
|
||||
|
||||
const parseKeymap = (keymap: Keymap) => Object.entries(keymap).map(([_patterns, callback]): Action => {
|
||||
const parseKeymap = (keymap: Keymap): Action[] => Object.entries(keymap).map(([_patterns, callback]): Action => {
|
||||
let patterns = _patterns;
|
||||
const result = {
|
||||
patterns: [],
|
||||
|
@ -66,12 +66,12 @@ function match(ev: KeyboardEvent, patterns: Action['patterns']): boolean {
|
|||
);
|
||||
}
|
||||
|
||||
export const makeHotkey = (keymap: Keymap) => {
|
||||
export const makeHotkey = (keymap: Keymap): (ev: KeyboardEvent) => void => {
|
||||
const actions = parseKeymap(keymap);
|
||||
|
||||
return (ev: KeyboardEvent) => {
|
||||
if (document.activeElement) {
|
||||
if (ignoreElemens.some(el => document.activeElement!.matches(el))) return;
|
||||
if (ignoreElemens.some(el => document.activeElement?.matches(el))) return;
|
||||
if (document.activeElement.attributes['contenteditable']) return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue