client: fix lints in scripts/hotkey.ts
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/test Pipeline was successful

This commit is contained in:
Norm 2022-09-19 18:49:59 -04:00
parent ee46d32602
commit 2628f35012
Signed by: norm
GPG key ID: 7123E30E441E80DE

View file

@ -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;
}