aboutsummaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-17 16:55:45 -0500
committerGitHub <noreply@github.com>2021-01-17 16:55:45 -0500
commit14b4aee07dc3f69ad75518cf04cafe416e06f0c7 (patch)
tree407918a74817284cd9f1d474a6c7783033e7a4c6 /ext/bg
parent8ec48456e6d73e10239469c39e7862365db43739 (diff)
Hotkey forwarding support (#1263)
* Add support for allowing HotkeyHandler to forward hotkeys * Update hotkey registration * Pass HotkeyHandler instance into Display* constructor * Implement hotkey forwarding
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/search-main.js7
-rw-r--r--ext/bg/js/search.js4
2 files changed, 8 insertions, 3 deletions
diff --git a/ext/bg/js/search-main.js b/ext/bg/js/search-main.js
index 73bc6750..38c6f4dd 100644
--- a/ext/bg/js/search-main.js
+++ b/ext/bg/js/search-main.js
@@ -18,6 +18,7 @@
/* global
* DisplaySearch
* DocumentFocusController
+ * HotkeyHandler
* JapaneseUtil
* api
* wanakana
@@ -32,7 +33,11 @@
await yomichan.backendReady();
const japaneseUtil = new JapaneseUtil(wanakana);
- const displaySearch = new DisplaySearch(japaneseUtil, documentFocusController);
+
+ const hotkeyHandler = new HotkeyHandler();
+ hotkeyHandler.prepare();
+
+ const displaySearch = new DisplaySearch(japaneseUtil, documentFocusController, hotkeyHandler);
await displaySearch.prepare();
document.documentElement.dataset.loaded = 'true';
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js
index 5963c03b..e2497264 100644
--- a/ext/bg/js/search.js
+++ b/ext/bg/js/search.js
@@ -23,8 +23,8 @@
*/
class DisplaySearch extends Display {
- constructor(japaneseUtil, documentFocusController) {
- super('search', japaneseUtil, documentFocusController);
+ constructor(japaneseUtil, documentFocusController, hotkeyHandler) {
+ super('search', japaneseUtil, documentFocusController, hotkeyHandler);
this._searchButton = document.querySelector('#search-button');
this._queryInput = document.querySelector('#search-textbox');
this._introElement = document.querySelector('#intro');