aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-17 19:28:42 -0500
committerGitHub <noreply@github.com>2021-01-17 19:28:42 -0500
commitc875ca728f619c6e6bccbd13ceb90d898c59e53e (patch)
treeedcf6862bd5d33eefea6c1a2af867b16d1040081 /ext/bg/js
parentde5d3ec3ad608893a9db75229296094f85c200c3 (diff)
Add support for frontend hotkeys; add scanSelectedText action (#1266)
* Add support for frontend hotkeys; add scanSelectedText action * Remove unused global * Remove duplicate hotkey handler script
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/settings/popup-preview-frame-main.js6
-rw-r--r--ext/bg/js/settings/popup-preview-frame.js6
2 files changed, 9 insertions, 3 deletions
diff --git a/ext/bg/js/settings/popup-preview-frame-main.js b/ext/bg/js/settings/popup-preview-frame-main.js
index a639ced7..71454017 100644
--- a/ext/bg/js/settings/popup-preview-frame-main.js
+++ b/ext/bg/js/settings/popup-preview-frame-main.js
@@ -16,6 +16,7 @@
*/
/* global
+ * HotkeyHandler
* PopupFactory
* PopupPreviewFrame
* api
@@ -27,10 +28,13 @@
const {frameId} = await api.frameInformationGet();
+ const hotkeyHandler = new HotkeyHandler();
+ hotkeyHandler.prepare();
+
const popupFactory = new PopupFactory(frameId);
popupFactory.prepare();
- const preview = new PopupPreviewFrame(frameId, popupFactory);
+ const preview = new PopupPreviewFrame(frameId, popupFactory, hotkeyHandler);
await preview.prepare();
document.documentElement.dataset.loaded = 'true';
diff --git a/ext/bg/js/settings/popup-preview-frame.js b/ext/bg/js/settings/popup-preview-frame.js
index 73d8882a..92b57c7a 100644
--- a/ext/bg/js/settings/popup-preview-frame.js
+++ b/ext/bg/js/settings/popup-preview-frame.js
@@ -23,9 +23,10 @@
*/
class PopupPreviewFrame {
- constructor(frameId, popupFactory) {
+ constructor(frameId, popupFactory, hotkeyHandler) {
this._frameId = frameId;
this._popupFactory = popupFactory;
+ this._hotkeyHandler = hotkeyHandler;
this._frontend = null;
this._apiOptionsGetOld = null;
this._popupShown = false;
@@ -74,7 +75,8 @@ class PopupPreviewFrame {
useProxyPopup: false,
pageType: 'web',
allowRootFramePopupProxy: false,
- childrenSupported: false
+ childrenSupported: false,
+ hotkeyHandler: this._hotkeyHandler
});
this._frontend.setOptionsContextOverride(this._optionsContext);
await this._frontend.prepare();