diff options
Diffstat (limited to 'ext/bg/js/search.js')
-rw-r--r-- | ext/bg/js/search.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js index 00148418..5963c03b 100644 --- a/ext/bg/js/search.js +++ b/ext/bg/js/search.js @@ -44,7 +44,7 @@ class DisplaySearch extends Display { }); this.autoPlayAudioDelay = 0; - this.registerActions([ + this.hotkeyHandler.registerActions([ ['focusSearchBox', this._onActionFocusSearchBox.bind(this)] ]); } @@ -73,6 +73,7 @@ class DisplaySearch extends Display { window.addEventListener('copy', this._onCopy.bind(this)); this._clipboardMonitor.on('change', this._onExternalSearchUpdate.bind(this)); this._clipboardMonitorEnableCheckbox.addEventListener('change', this._onClipboardMonitorEnableChange.bind(this)); + this.hotkeyHandler.on('keydownNonHotkey', this._onKeyDown.bind(this)); this._onModeChange(); @@ -81,19 +82,6 @@ class DisplaySearch extends Display { this._isPrepared = true; } - onKeyDown(e) { - if ( - !super.onKeyDown(e) && - document.activeElement !== this._queryInput && - !e.ctrlKey && - !e.metaKey && - !e.altKey && - e.key.length === 1 - ) { - this._queryInput.focus({preventScroll: true}); - } - } - postProcessQuery(query) { if (this._wanakanaEnabled) { try { @@ -115,6 +103,18 @@ class DisplaySearch extends Display { // Private + _onKeyDown(e) { + if ( + document.activeElement !== this._queryInput && + !e.ctrlKey && + !e.metaKey && + !e.altKey && + e.key.length === 1 + ) { + this._queryInput.focus({preventScroll: true}); + } + } + async _onOptionsUpdated() { await this.updateOptions(); const query = this._queryInput.value; |