Merge pull request #66 from ajdor/master
Keyboard shortcuts and hotkeys
This commit is contained in:
@@ -70,4 +70,4 @@ async function handleOnClickContextMenu(info, tab) {
|
||||
generateAliasHandlerJS(tab, res);
|
||||
}
|
||||
|
||||
export { handleOnClickContextMenu };
|
||||
export { handleOnClickContextMenu, generateAliasHandlerJS };
|
||||
|
||||
+17
-1
@@ -5,7 +5,10 @@ import Onboarding from "./onboarding";
|
||||
import "./content-script";
|
||||
|
||||
import { handleNewRandomAlias } from "./create-alias";
|
||||
import { handleOnClickContextMenu } from "./context-menu";
|
||||
import {
|
||||
handleOnClickContextMenu,
|
||||
generateAliasHandlerJS,
|
||||
} from "./context-menu";
|
||||
import { firePermissionListener } from "./permissions";
|
||||
|
||||
global.isBackgroundJS = true;
|
||||
@@ -46,5 +49,18 @@ browser.contextMenus.create({
|
||||
onclick: handleOnClickContextMenu,
|
||||
});
|
||||
|
||||
/**
|
||||
* Shortcuts and hotkeys listener
|
||||
*/
|
||||
browser.commands.onCommand.addListener(async (command) => {
|
||||
if (command === "generate-random-alias") {
|
||||
const currentTab = (
|
||||
await browser.tabs.query({ active: true, currentWindow: true })
|
||||
)[0];
|
||||
const res = await handleNewRandomAlias(currentTab.url);
|
||||
generateAliasHandlerJS(currentTab, res);
|
||||
}
|
||||
});
|
||||
|
||||
APIService.initService();
|
||||
Onboarding.initService();
|
||||
|
||||
@@ -33,5 +33,19 @@
|
||||
"scripts": [
|
||||
"background.js"
|
||||
]
|
||||
},
|
||||
"commands": {
|
||||
"generate-random-alias": {
|
||||
"suggested_key": {
|
||||
"default": "Ctrl+Shift+X"
|
||||
},
|
||||
"description": "Generate a random email alias"
|
||||
},
|
||||
"_execute_browser_action": {
|
||||
"suggested_key": {
|
||||
"default": "Ctrl+Shift+S"
|
||||
},
|
||||
"description":"Open the extension action menu"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user