mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
Use Record type for shortcut map too
This commit is contained in:
parent
6ffa24b4b8
commit
45df8a878e
1 changed files with 2 additions and 4 deletions
|
@ -4,9 +4,7 @@
|
||||||
|
|
||||||
import { $ } from './utils/dom';
|
import { $ } from './utils/dom';
|
||||||
|
|
||||||
interface ShortcutKeycodes {
|
type ShortcutKeyMap = Record<string, () => void>;
|
||||||
[key: string]: () => void
|
|
||||||
}
|
|
||||||
|
|
||||||
function getHover(): string | null {
|
function getHover(): string | null {
|
||||||
const thumbBoxHover = $<HTMLDivElement>('.media-box:hover');
|
const thumbBoxHover = $<HTMLDivElement>('.media-box:hover');
|
||||||
|
@ -45,7 +43,7 @@ function isOK(event: KeyboardEvent): boolean {
|
||||||
document.activeElement.tagName !== 'TEXTAREA';
|
document.activeElement.tagName !== 'TEXTAREA';
|
||||||
}
|
}
|
||||||
|
|
||||||
const keyCodes: ShortcutKeycodes = {
|
const keyCodes: ShortcutKeyMap = {
|
||||||
KeyJ() { click('.js-prev'); }, // J - go to previous image
|
KeyJ() { click('.js-prev'); }, // J - go to previous image
|
||||||
KeyI() { click('.js-up'); }, // I - go to index page
|
KeyI() { click('.js-up'); }, // I - go to index page
|
||||||
KeyK() { click('.js-next'); }, // K - go to next image
|
KeyK() { click('.js-next'); }, // K - go to next image
|
||||||
|
|
Loading…
Reference in a new issue