Standardize hotkey action naming convention (#696)

This commit is contained in:
toasted-nutbread 2020-07-26 20:25:15 -04:00 committed by GitHub
parent 313476aa92
commit 6e0b25c5d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 29 deletions

View File

@ -32,10 +32,10 @@ class DisplayFloat extends Display {
]); ]);
this.registerActions([ this.registerActions([
['copy-host-selection', () => this._copySelection()] ['copyHostSelection', () => this._copySelection()]
]); ]);
this.registerHotkeys([ this.registerHotkeys([
{key: 'C', modifiers: ['ctrl'], action: 'copy-host-selection'} {key: 'C', modifiers: ['ctrl'], action: 'copyHostSelection'}
]); ]);
this.autoPlayAudioDelay = 400; this.autoPlayAudioDelay = 400;

View File

@ -76,36 +76,36 @@ class Display extends EventDispatcher {
}); });
this.registerActions([ this.registerActions([
['close', () => { this.onEscape(); }], ['close', () => { this.onEscape(); }],
['next-entry', () => { this._focusEntry(this._index + 1, true); }], ['nextEntry', () => { this._focusEntry(this._index + 1, true); }],
['next-entry-x3', () => { this._focusEntry(this._index + 3, true); }], ['nextEntry3', () => { this._focusEntry(this._index + 3, true); }],
['previous-entry', () => { this._focusEntry(this._index - 1, true); }], ['previousEntry', () => { this._focusEntry(this._index - 1, true); }],
['previous-entry-x3', () => { this._focusEntry(this._index - 3, true); }], ['previousEntry3', () => { this._focusEntry(this._index - 3, true); }],
['last-entry', () => { this._focusEntry(this._definitions.length - 1, true); }], ['lastEntry', () => { this._focusEntry(this._definitions.length - 1, true); }],
['first-entry', () => { this._focusEntry(0, true); }], ['firstEntry', () => { this._focusEntry(0, true); }],
['history-backward', () => { this._sourceTermView(); }], ['historyBackward', () => { this._sourceTermView(); }],
['history-forward', () => { this._nextTermView(); }], ['historyForward', () => { this._nextTermView(); }],
['add-note-kanji', () => { this._noteTryAdd('kanji'); }], ['addNoteKanji', () => { this._noteTryAdd('kanji'); }],
['add-note-term-kanji', () => { this._noteTryAdd('term-kanji'); }], ['addNoteTermKanji', () => { this._noteTryAdd('term-kanji'); }],
['add-note-term-kana', () => { this._noteTryAdd('term-kana'); }], ['addNoteTermKana', () => { this._noteTryAdd('term-kana'); }],
['view-note', () => { this._noteTryView(); }], ['viewNote', () => { this._noteTryView(); }],
['play-audio', () => { this._playAudioCurrent(); }] ['playAudio', () => { this._playAudioCurrent(); }]
]); ]);
this.registerHotkeys([ this.registerHotkeys([
{key: 'Escape', modifiers: [], action: 'close'}, {key: 'Escape', modifiers: [], action: 'close'},
{key: 'PageUp', modifiers: ['alt'], action: 'previous-entry-x3'}, {key: 'PageUp', modifiers: ['alt'], action: 'previousEntry3'},
{key: 'PageDown', modifiers: ['alt'], action: 'next-entry-x3'}, {key: 'PageDown', modifiers: ['alt'], action: 'nextEntry3'},
{key: 'End', modifiers: ['alt'], action: 'last-entry'}, {key: 'End', modifiers: ['alt'], action: 'lastEntry'},
{key: 'Home', modifiers: ['alt'], action: 'first-entry'}, {key: 'Home', modifiers: ['alt'], action: 'firstEntry'},
{key: 'ArrowUp', modifiers: ['alt'], action: 'previous-entry'}, {key: 'ArrowUp', modifiers: ['alt'], action: 'previousEntry'},
{key: 'ArrowDown', modifiers: ['alt'], action: 'next-entry'}, {key: 'ArrowDown', modifiers: ['alt'], action: 'nextEntry'},
{key: 'B', modifiers: ['alt'], action: 'history-backward'}, {key: 'B', modifiers: ['alt'], action: 'historyBackward'},
{key: 'F', modifiers: ['alt'], action: 'history-forward'}, {key: 'F', modifiers: ['alt'], action: 'historyForward'},
{key: 'K', modifiers: ['alt'], action: 'add-note-kanji'}, {key: 'K', modifiers: ['alt'], action: 'addNoteKanji'},
{key: 'E', modifiers: ['alt'], action: 'add-note-term-kanji'}, {key: 'E', modifiers: ['alt'], action: 'addNoteTermKanji'},
{key: 'R', modifiers: ['alt'], action: 'add-note-term-kana'}, {key: 'R', modifiers: ['alt'], action: 'addNoteTermKana'},
{key: 'P', modifiers: ['alt'], action: 'play-audio'}, {key: 'P', modifiers: ['alt'], action: 'playAudio'},
{key: 'V', modifiers: ['alt'], action: 'view-note'} {key: 'V', modifiers: ['alt'], action: 'viewNote'}
]); ]);
this.registerMessageHandlers([ this.registerMessageHandlers([
['setOptionsContext', {async: false, handler: this._onMessageSetOptionsContext.bind(this)}], ['setOptionsContext', {async: false, handler: this._onMessageSetOptionsContext.bind(this)}],