mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-30 03:32:26 +08:00
Add support for keyboard shortcuts
This commit is contained in:
parent
abc26a3867
commit
d9f6862978
@ -1,3 +1,18 @@
|
|||||||
|
// Keyboard shortcuts
|
||||||
|
chrome.commands.onCommand.addListener(async function (command) {
|
||||||
|
if(command=="saveSelection") {
|
||||||
|
await saveSelection();
|
||||||
|
} else if (command == "saveWholePage") {
|
||||||
|
await saveWholePage();
|
||||||
|
} else if (command == "saveScreenshot") {
|
||||||
|
const activeTab = await getActiveTab();
|
||||||
|
await saveScreenshot(activeTab);
|
||||||
|
} else {
|
||||||
|
console.log("Unrecognized command", command);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
function cropImage(newArea, dataUrl) {
|
function cropImage(newArea, dataUrl) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
|
@ -47,6 +47,26 @@
|
|||||||
"options_ui": {
|
"options_ui": {
|
||||||
"page": "options/options.html"
|
"page": "options/options.html"
|
||||||
},
|
},
|
||||||
|
"commands": {
|
||||||
|
"saveSelection": {
|
||||||
|
"description": "Save the selected text into a note",
|
||||||
|
"suggested_key": {
|
||||||
|
"default": "Ctrl+Shift+S"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"saveWholePage": {
|
||||||
|
"description": "Save the current page",
|
||||||
|
"suggested_key": {
|
||||||
|
"default": "Alt+Shift+S"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"saveScreenshot": {
|
||||||
|
"description": "Take a screenshot of the current page",
|
||||||
|
"suggested_key": {
|
||||||
|
"default": "Ctrl+Shift+E"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"browser_specific_settings": {
|
"browser_specific_settings": {
|
||||||
"gecko": {
|
"gecko": {
|
||||||
"id": "{1410742d-b377-40e7-a9db-63dc9c6ec99c}"
|
"id": "{1410742d-b377-40e7-a9db-63dc9c6ec99c}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user