diff --git a/src/public/javascripts/services/context_menu.js b/src/public/javascripts/services/context_menu.js
index 1dd265f9a..4622b980e 100644
--- a/src/public/javascripts/services/context_menu.js
+++ b/src/public/javascripts/services/context_menu.js
@@ -1,3 +1,4 @@
+import keyboardActionService from './keyboard_actions.js';
const $contextMenuContainer = $("#context-menu-container");
let dateContextMenuOpenedMs = 0;
@@ -69,6 +70,8 @@ async function initContextMenu(event, contextMenu) {
addItems($contextMenuContainer, await contextMenu.getContextMenuItems());
+ keyboardActionService.updateKbdElements($contextMenuContainer);
+
// code below tries to detect when dropdown would overflow from page
// in such case we'll position it above click coordinates so it will fit into client
const clickPosition = event.pageY;
diff --git a/src/public/javascripts/services/entrypoints.js b/src/public/javascripts/services/entrypoints.js
index ae5eb30b1..67dd54054 100644
--- a/src/public/javascripts/services/entrypoints.js
+++ b/src/public/javascripts/services/entrypoints.js
@@ -121,7 +121,7 @@ function registerEntrypoints() {
});
$("#reload-frontend-button").on('click', utils.reloadApp);
- keyboardActionService.setActionHandler("ReloadApp", utils.reloadApp);
+ keyboardActionService.setActionHandler("ReloadFrontendApp", utils.reloadApp);
$("#open-dev-tools-button").toggle(utils.isElectron());
diff --git a/src/public/javascripts/services/keyboard_actions.js b/src/public/javascripts/services/keyboard_actions.js
index 1498788f6..1a77688cc 100644
--- a/src/public/javascripts/services/keyboard_actions.js
+++ b/src/public/javascripts/services/keyboard_actions.js
@@ -61,20 +61,39 @@ async function triggerAction(actionName) {
await action.handler();
}
-async function getAction(actionName) {
+async function getAction(actionName, silent = false) {
await keyboardActionsLoaded;
const action = keyboardActionRepo[actionName];
if (!action) {
- throw new Error(`Cannot find action ${actionName}`);
+ if (silent) {
+ console.log(`Cannot find action ${actionName}`);
+ }
+ else {
+ throw new Error(`Cannot find action ${actionName}`);
+ }
}
return action;
}
+function updateKbdElements($container) {
+ $container.find('kbd[data-kb-action]').each(async (i, el) => {
+ const actionName = $(el).attr('data-kb-action');
+ const action = await getAction(actionName, true);
+
+ if (action) {
+ $(el).text(action.effectiveShortcuts.join(', '));
+ }
+ });
+}
+
+$(() => updateKbdElements($(document)));
+
export default {
setActionHandler,
triggerAction,
- getAction
+ getAction,
+ updateKbdElements
};
\ No newline at end of file
diff --git a/src/public/javascripts/services/tree_context_menu.js b/src/public/javascripts/services/tree_context_menu.js
index f565b8fff..344083608 100644
--- a/src/public/javascripts/services/tree_context_menu.js
+++ b/src/public/javascripts/services/tree_context_menu.js
@@ -46,39 +46,39 @@ class TreeContextMenu {
const insertNoteAfterEnabled = isNotRoot && !isHoisted && parentNotSearch;
return [
- { title: "Open in new tab", cmd: "openInTab", uiIcon: "empty", enabled: noSelectedNotes },
- { title: "Insert note after Ctrl+O", cmd: "insertNoteAfter", uiIcon: "plus",
+ { title: 'Open in new tab', cmd: "openInTab", uiIcon: "empty", enabled: noSelectedNotes },
+ { title: 'Insert note after ', cmd: "insertNoteAfter", uiIcon: "plus",
items: insertNoteAfterEnabled ? this.getNoteTypeItems("insertNoteAfter") : null,
enabled: insertNoteAfterEnabled && noSelectedNotes },
- { title: "Insert child note Ctrl+P", cmd: "insertChildNote", uiIcon: "plus",
+ { title: 'Insert child note ', cmd: "insertChildNote", uiIcon: "plus",
items: notSearch ? this.getNoteTypeItems("insertChildNote") : null,
enabled: notSearch && noSelectedNotes },
- { title: "Delete Delete", cmd: "delete", uiIcon: "trash",
+ { title: 'Delete ', cmd: "delete", uiIcon: "trash",
enabled: isNotRoot && !isHoisted && parentNotSearch },
{ title: "----" },
- { title: "Search in subtree Ctrl+Shift+S", cmd: "searchInSubtree", uiIcon: "search",
+ { title: 'Search in subtree ', cmd: "searchInSubtree", uiIcon: "search",
enabled: notSearch && noSelectedNotes },
- isHoisted ? null : { title: "Hoist note Ctrl-H", cmd: "hoist", uiIcon: "empty", enabled: noSelectedNotes && notSearch },
- !isHoisted || !isNotRoot ? null : { title: "Unhoist note Ctrl-H", cmd: "unhoist", uiIcon: "arrow-up" },
- { title: "Edit branch prefix F2", cmd: "editBranchPrefix", uiIcon: "empty",
+ isHoisted ? null : { title: 'Hoist note ', cmd: "hoist", uiIcon: "empty", enabled: noSelectedNotes && notSearch },
+ !isHoisted || !isNotRoot ? null : { title: 'Unhoist note ', cmd: "unhoist", uiIcon: "arrow-up" },
+ { title: 'Edit branch prefix ', cmd: "editBranchPrefix", uiIcon: "empty",
enabled: isNotRoot && parentNotSearch && noSelectedNotes},
{ title: "----" },
{ title: "Protect subtree", cmd: "protectSubtree", uiIcon: "check-shield", enabled: noSelectedNotes },
{ title: "Unprotect subtree", cmd: "unprotectSubtree", uiIcon: "shield", enabled: noSelectedNotes },
{ title: "----" },
- { title: "Copy / clone Ctrl+C", cmd: "copy", uiIcon: "copy",
+ { title: 'Copy / clone ', cmd: "copy", uiIcon: "copy",
enabled: isNotRoot && !isHoisted },
- { title: "Clone to ... Ctrl+Shift+C", cmd: "cloneTo", uiIcon: "empty",
+ { title: 'Clone to ... ', cmd: "cloneTo", uiIcon: "empty",
enabled: isNotRoot && !isHoisted },
- { title: "Cut Ctrl+X", cmd: "cut", uiIcon: "cut",
+ { title: 'Cut ', cmd: "cut", uiIcon: "cut",
enabled: isNotRoot && !isHoisted && parentNotSearch },
- { title: "Move to ... Ctrl+Shift+X", cmd: "moveTo", uiIcon: "empty",
+ { title: 'Move to ... Ctrl+Shift+X', cmd: "moveTo", uiIcon: "empty",
enabled: isNotRoot && !isHoisted && parentNotSearch },
- { title: "Paste into Ctrl+V", cmd: "pasteInto", uiIcon: "paste",
+ { title: 'Paste into Ctrl+V', cmd: "pasteInto", uiIcon: "paste",
enabled: !clipboard.isClipboardEmpty() && notSearch && noSelectedNotes },
- { title: "Paste after", cmd: "pasteAfter", uiIcon: "paste",
+ { title: 'Paste after', cmd: "pasteAfter", uiIcon: "paste",
enabled: !clipboard.isClipboardEmpty() && isNotRoot && !isHoisted && parentNotSearch && noSelectedNotes },
- { title: "Duplicate note here", cmd: "duplicateNote", uiIcon: "empty",
+ { title: 'Duplicate note here', cmd: "duplicateNote", uiIcon: "empty",
enabled: noSelectedNotes && parentNotSearch && (!note.isProtected || protectedSessionHolder.isProtectedSessionAvailable()) },
{ title: "----" },
{ title: "Export", cmd: "export", uiIcon: "empty",
@@ -86,9 +86,9 @@ class TreeContextMenu {
{ title: "Import into note", cmd: "importIntoNote", uiIcon: "empty",
enabled: notSearch && noSelectedNotes },
{ title: "----" },
- { title: "Collapse subtree Alt+-", cmd: "collapseSubtree", uiIcon: "align-justify", enabled: noSelectedNotes },
+ { title: 'Collapse subtree Alt+-', cmd: "collapseSubtree", uiIcon: "align-justify", enabled: noSelectedNotes },
{ title: "Force note sync", cmd: "forceNoteSync", uiIcon: "recycle", enabled: noSelectedNotes },
- { title: "Sort alphabetically Alt+S", cmd: "sortAlphabetically", uiIcon: "empty", enabled: noSelectedNotes && notSearch }
+ { title: 'Sort alphabetically Alt+S', cmd: "sortAlphabetically", uiIcon: "empty", enabled: noSelectedNotes && notSearch }
].filter(row => row !== null);
}
diff --git a/src/public/javascripts/services/tree_keybindings.js b/src/public/javascripts/services/tree_keybindings.js
index 4d3ecb14a..27efd93d2 100644
--- a/src/public/javascripts/services/tree_keybindings.js
+++ b/src/public/javascripts/services/tree_keybindings.js
@@ -34,7 +34,7 @@ const fixedKeyBindings = {
};
const templates = {
- "DeleteNote": node => {
+ "DeleteNotes": node => {
treeChangesService.deleteNodes(treeService.getSelectedOrActiveNodes(node));
},
"MoveNoteUp": node => {
diff --git a/src/services/keyboard_actions.js b/src/services/keyboard_actions.js
index 18a65a706..2f39bd8f2 100644
--- a/src/services/keyboard_actions.js
+++ b/src/services/keyboard_actions.js
@@ -114,7 +114,7 @@ const DEFAULT_KEYBOARD_ACTIONS = [
defaultShortcuts: ["CommandOrControl+return"]
},
{
- actionName: "DeleteNote",
+ actionName: "DeleteNotes",
defaultShortcuts: ["Delete"],
description: "Delete note"
},
@@ -185,7 +185,7 @@ const DEFAULT_KEYBOARD_ACTIONS = [
},
{
actionName: "ToggleNoteHoisting",
- defaultShortcuts: ["Alt+h"],
+ defaultShortcuts: ["Alt+H"],
description: "Toggles note hoisting of active note"
},
{
@@ -195,7 +195,7 @@ const DEFAULT_KEYBOARD_ACTIONS = [
},
{
actionName: "EditNoteTitle",
- defaultShortcuts: ["return"],
+ defaultShortcuts: ["Return"],
description: "Edit active note title"
},
{
@@ -236,7 +236,7 @@ const DEFAULT_KEYBOARD_ACTIONS = [
defaultShortcuts: ["Alt+T"]
},
{
- actionName: "ReloadApp",
+ actionName: "ReloadFrontendApp",
defaultShortcuts: ["F5", "CommandOrControl+R"]
},
{
diff --git a/src/views/desktop.ejs b/src/views/desktop.ejs
index 41b1fa7be..84071e1ff 100644
--- a/src/views/desktop.ejs
+++ b/src/views/desktop.ejs
@@ -66,37 +66,37 @@
Open Dev Tools
- CTRL+SHIFT+I
+
Open SQL Console
- ALT+O
+
Reload frontend
- CTRL+R
+
Toggle Zen mode
- ALT+M
+
Toggle fullscreen
- F11
+
Show Help
- F1
+