camelCase keyboard action names

This commit is contained in:
zadam 2020-02-19 20:54:14 +01:00
parent 2e3534dfb7
commit 52f4876f2d
2 changed files with 59 additions and 59 deletions

View File

@ -9,7 +9,6 @@ const keyboardActionsLoaded = server.get('keyboard-actions').then(actions => {
for (const action of actions) { for (const action of actions) {
action.effectiveShortcuts = action.effectiveShortcuts.filter(shortcut => !shortcut.startsWith("global:")); action.effectiveShortcuts = action.effectiveShortcuts.filter(shortcut => !shortcut.startsWith("global:"));
action.actionName = action.actionName.charAt(0).toLowerCase() + action.actionName.slice(1);
keyboardActionRepo[action.actionName] = action; keyboardActionRepo[action.actionName] = action;
} }

View File

@ -12,58 +12,58 @@ const DEFAULT_KEYBOARD_ACTIONS = [
separator: "Note navigation" separator: "Note navigation"
}, },
{ {
actionName: "BackInNoteHistory", actionName: "backInNoteHistory",
// Mac has a different history navigation shortcuts - https://github.com/zadam/trilium/issues/376 // Mac has a different history navigation shortcuts - https://github.com/zadam/trilium/issues/376
defaultShortcuts: isMac ? ["Meta+Left"] : ["Alt+Left"], defaultShortcuts: isMac ? ["Meta+Left"] : ["Alt+Left"],
scope: "window" scope: "window"
}, },
{ {
actionName: "ForwardInNoteHistory", actionName: "forwardInNoteHistory",
// Mac has a different history navigation shortcuts - https://github.com/zadam/trilium/issues/376 // Mac has a different history navigation shortcuts - https://github.com/zadam/trilium/issues/376
defaultShortcuts: isMac ? ["Meta+Right"] : ["Alt+Right"], defaultShortcuts: isMac ? ["Meta+Right"] : ["Alt+Right"],
scope: "window" scope: "window"
}, },
{ {
actionName: "JumpToNote", actionName: "jumpToNote",
defaultShortcuts: ["CommandOrControl+J"], defaultShortcuts: ["CommandOrControl+J"],
description: 'Open "Jump to note" dialog', description: 'Open "Jump to note" dialog',
scope: "window" scope: "window"
}, },
{ {
actionName: "ScrollToActiveNote", actionName: "scrollToActiveNote",
defaultShortcuts: ["CommandOrControl+."], defaultShortcuts: ["CommandOrControl+."],
scope: "window" // FIXME - how do we find what note tree should be updated? scope: "window" // FIXME - how do we find what note tree should be updated?
}, },
{ {
actionName: "SearchNotes", actionName: "searchNotes",
defaultShortcuts: ["CommandOrControl+S"], defaultShortcuts: ["CommandOrControl+S"],
scope: "window" scope: "window"
}, },
{ {
actionName: "SearchInSubtree", actionName: "searchInSubtree",
defaultShortcuts: ["CommandOrControl+Shift+S"], defaultShortcuts: ["CommandOrControl+Shift+S"],
description: "Search for notes in the active note's subtree", description: "Search for notes in the active note's subtree",
scope: "note-tree" scope: "note-tree"
}, },
{ {
actionName: "CollapseTree", actionName: "collapseTree",
defaultShortcuts: ["Alt+C"], defaultShortcuts: ["Alt+C"],
scope: "note-tree" scope: "note-tree"
}, },
{ {
actionName: "CollapseSubtree", actionName: "collapseSubtree",
defaultShortcuts: ["Alt+-"], defaultShortcuts: ["Alt+-"],
description: "Collapses subtree of current note", description: "Collapses subtree of current note",
scope: "note-tree" scope: "note-tree"
}, },
{ {
actionName: "ActivateParentNote", actionName: "activateParentNote",
defaultShortcuts: ["Backspace"], defaultShortcuts: ["Backspace"],
description: "Activates the parent note of currently active note", description: "Activates the parent note of currently active note",
scope: "note-tree" scope: "note-tree"
}, },
{ {
actionName: "SortChildNotes", actionName: "sortChildNotes",
defaultShortcuts: ["Alt+S"], defaultShortcuts: ["Alt+S"],
description: "Sort child notes", description: "Sort child notes",
scope: "note-tree" scope: "note-tree"
@ -74,70 +74,70 @@ const DEFAULT_KEYBOARD_ACTIONS = [
separator: "Creating and moving notes" separator: "Creating and moving notes"
}, },
{ {
actionName: "CreateNoteAfter", actionName: "createNoteAfter",
defaultShortcuts: ["CommandOrControl+O"], defaultShortcuts: ["CommandOrControl+O"],
scope: "window" scope: "window"
}, },
{ {
actionName: "CreateNoteInto", actionName: "createNoteInto",
defaultShortcuts: ["CommandOrControl+P"], defaultShortcuts: ["CommandOrControl+P"],
scope: "window" scope: "window"
}, },
{ {
actionName: "CreateNoteIntoDayNote", actionName: "createNoteIntoDayNote",
defaultShortcuts: ["global:CommandOrControl+Alt+P"], defaultShortcuts: ["global:CommandOrControl+Alt+P"],
description: "Create and open subnote of a current day note", description: "Create and open subnote of a current day note",
scope: "window" scope: "window"
}, },
{ {
actionName: "DeleteNotes", actionName: "deleteNotes",
defaultShortcuts: ["Delete"], defaultShortcuts: ["Delete"],
description: "Delete note", description: "Delete note",
scope: "note-tree" scope: "note-tree"
}, },
{ {
actionName: "MoveNoteUp", actionName: "moveNoteUp",
defaultShortcuts: ["CommandOrControl+Up"], defaultShortcuts: ["CommandOrControl+Up"],
description: "Move note up", description: "Move note up",
scope: "note-tree" scope: "note-tree"
}, },
{ {
actionName: "MoveNoteDown", actionName: "moveNoteDown",
defaultShortcuts: ["CommandOrControl+Down"], defaultShortcuts: ["CommandOrControl+Down"],
description: "Move note down", description: "Move note down",
scope: "note-tree" scope: "note-tree"
}, },
{ {
actionName: "MoveNoteUpInHierarchy", actionName: "moveNoteUpInHierarchy",
defaultShortcuts: ["CommandOrControl+Left"], defaultShortcuts: ["CommandOrControl+Left"],
description: "Move note up in hierarchy", description: "Move note up in hierarchy",
scope: "note-tree" scope: "note-tree"
}, },
{ {
actionName: "MoveNoteDownInHierarchy", actionName: "moveNoteDownInHierarchy",
defaultShortcuts: ["CommandOrControl+Right"], defaultShortcuts: ["CommandOrControl+Right"],
description: "Move note down in hierarchy", description: "Move note down in hierarchy",
scope: "note-tree" scope: "note-tree"
}, },
{ {
actionName: "EditNoteTitle", actionName: "editNoteTitle",
defaultShortcuts: ["Enter"], defaultShortcuts: ["Enter"],
description: "Jump from tree to the note detail and edit title", description: "Jump from tree to the note detail and edit title",
scope: "note-tree" scope: "note-tree"
}, },
{ {
actionName: "EditBranchPrefix", actionName: "editBranchPrefix",
defaultShortcuts: ["F2"], defaultShortcuts: ["F2"],
description: "Show Edit branch prefix dialog", description: "Show Edit branch prefix dialog",
scope: "window" scope: "window"
}, },
{ {
actionName: "CloneNotesTo", actionName: "cloneNotesTo",
defaultShortcuts: ["CommandOrControl+Shift+C"], defaultShortcuts: ["CommandOrControl+Shift+C"],
scope: "window" scope: "window"
}, },
{ {
actionName: "MoveNotesTo", actionName: "moveNotesTo",
defaultShortcuts: ["CommandOrControl+Shift+X"], defaultShortcuts: ["CommandOrControl+Shift+X"],
scope: "window" scope: "window"
}, },
@ -148,37 +148,37 @@ const DEFAULT_KEYBOARD_ACTIONS = [
{ {
actionName: "CopyNotesToClipboard", actionName: "copyNotesToClipboard",
defaultShortcuts: ["CommandOrControl+C"], defaultShortcuts: ["CommandOrControl+C"],
description: "Copy selected notes to the clipboard", description: "Copy selected notes to the clipboard",
scope: "note-tree" scope: "note-tree"
}, },
{ {
actionName: "PasteNotesFromClipboard", actionName: "pasteNotesFromClipboard",
defaultShortcuts: ["CommandOrControl+V"], defaultShortcuts: ["CommandOrControl+V"],
description: "Paste notes from the clipboard into active note", description: "Paste notes from the clipboard into active note",
scope: "note-tree" scope: "note-tree"
}, },
{ {
actionName: "CutNotesToClipboard", actionName: "cutNotesToClipboard",
defaultShortcuts: ["CommandOrControl+X"], defaultShortcuts: ["CommandOrControl+X"],
description: "Cut selected notes to the clipboard", description: "Cut selected notes to the clipboard",
scope: "note-tree" scope: "note-tree"
}, },
{ {
actionName: "SelectAllNotesInParent", actionName: "selectAllNotesInParent",
defaultShortcuts: ["CommandOrControl+A"], defaultShortcuts: ["CommandOrControl+A"],
description: "Select all notes from the current note level", description: "Select all notes from the current note level",
scope: "note-tree" scope: "note-tree"
}, },
{ {
actionName: "AddNoteAboveToSelection", actionName: "addNoteAboveToSelection",
defaultShortcuts: ["Shift+Up"], defaultShortcuts: ["Shift+Up"],
description: "Add note above to the selection", description: "Add note above to the selection",
scope: "note-tree" scope: "note-tree"
}, },
{ {
actionName: "AddNoteBelowToSelection", actionName: "addNoteBelowToSelection",
defaultShortcuts: ["Shift+Down"], defaultShortcuts: ["Shift+Down"],
description: "Add note above to the selection", description: "Add note above to the selection",
scope: "note-tree" scope: "note-tree"
@ -189,25 +189,25 @@ const DEFAULT_KEYBOARD_ACTIONS = [
separator: "Tabs" separator: "Tabs"
}, },
{ {
actionName: "OpenNewTab", actionName: "openNewTab",
defaultShortcuts: isElectron ? ["CommandOrControl+T"] : [], defaultShortcuts: isElectron ? ["CommandOrControl+T"] : [],
description: "Opens new tab", description: "Opens new tab",
scope: "window" scope: "window"
}, },
{ {
actionName: "CloseActiveTab", actionName: "closeActiveTab",
defaultShortcuts: isElectron ? ["CommandOrControl+W"] : [], defaultShortcuts: isElectron ? ["CommandOrControl+W"] : [],
description: "Closes active tab", description: "Closes active tab",
scope: "window" scope: "window"
}, },
{ {
actionName: "ActivateNextTab", actionName: "activateNextTab",
defaultShortcuts: isElectron ? ["CommandOrControl+Tab"] : [], defaultShortcuts: isElectron ? ["CommandOrControl+Tab"] : [],
description: "Activates tab on the right", description: "Activates tab on the right",
scope: "window" scope: "window"
}, },
{ {
actionName: "ActivatePreviousTab", actionName: "activatePreviousTab",
defaultShortcuts: isElectron ? ["CommandOrControl+Shift+Tab"] : [], defaultShortcuts: isElectron ? ["CommandOrControl+Shift+Tab"] : [],
description: "Activates tab on the left", description: "Activates tab on the left",
scope: "window" scope: "window"
@ -218,61 +218,61 @@ const DEFAULT_KEYBOARD_ACTIONS = [
separator: "Dialogs" separator: "Dialogs"
}, },
{ {
actionName: "ShowAttributes", actionName: "showAttributes",
defaultShortcuts: ["Alt+A"], defaultShortcuts: ["Alt+A"],
description: "Shows Attributes dialog", description: "Shows Attributes dialog",
scope: "window" scope: "window"
}, },
{ {
actionName: "ShowNoteInfo", actionName: "showNoteInfo",
defaultShortcuts: [], defaultShortcuts: [],
description: "Shows Note Info dialog", description: "Shows Note Info dialog",
scope: "window" scope: "window"
}, },
{ {
actionName: "ShowNoteSource", actionName: "showNoteSource",
defaultShortcuts: [], defaultShortcuts: [],
description: "Shows Note Source dialog", description: "Shows Note Source dialog",
scope: "window" scope: "window"
}, },
{ {
actionName: "ShowLinkMap", actionName: "showLinkMap",
defaultShortcuts: [], defaultShortcuts: [],
description: "Shows Link Map dialog", description: "Shows Link Map dialog",
scope: "window" scope: "window"
}, },
{ {
actionName: "ShowOptions", actionName: "showOptions",
defaultShortcuts: [], defaultShortcuts: [],
description: "Shows Options dialog", description: "Shows Options dialog",
scope: "window" scope: "window"
}, },
{ {
actionName: "ShowNoteRevisions", actionName: "showNoteRevisions",
defaultShortcuts: [], defaultShortcuts: [],
description: "Shows Note Revisions dialog", description: "Shows Note Revisions dialog",
scope: "window" scope: "window"
}, },
{ {
actionName: "ShowRecentChanges", actionName: "showRecentChanges",
defaultShortcuts: [], defaultShortcuts: [],
description: "Shows Recent Changes dialog", description: "Shows Recent Changes dialog",
scope: "window" scope: "window"
}, },
{ {
actionName: "ShowSQLConsole", actionName: "showSQLConsole",
defaultShortcuts: ["Alt+O"], defaultShortcuts: ["Alt+O"],
description: "Shows SQL Console dialog", description: "Shows SQL Console dialog",
scope: "window" scope: "window"
}, },
{ {
actionName: "ShowBackendLog", actionName: "showBackendLog",
defaultShortcuts: [], defaultShortcuts: [],
description: "Shows Backend Log dialog", description: "Shows Backend Log dialog",
scope: "window" scope: "window"
}, },
{ {
actionName: "ShowHelp", actionName: "showHelp",
defaultShortcuts: ["F1"], defaultShortcuts: ["F1"],
description: "Shows built-in Help / cheatsheet", description: "Shows built-in Help / cheatsheet",
scope: "window" scope: "window"
@ -284,24 +284,24 @@ const DEFAULT_KEYBOARD_ACTIONS = [
}, },
{ {
actionName: "AddLinkToText", actionName: "addLinkToText",
defaultShortcuts: ["CommandOrControl+L"], defaultShortcuts: ["CommandOrControl+L"],
description: "Open dialog to add link to the text", description: "Open dialog to add link to the text",
scope: "text-detail" scope: "text-detail"
}, },
{ {
actionName: "InsertDateTimeToText", actionName: "insertDateTimeToText",
defaultShortcuts: ["Alt+T"], defaultShortcuts: ["Alt+T"],
scope: "text-detail" scope: "text-detail"
}, },
{ {
actionName: "PasteMarkdownIntoText", actionName: "pasteMarkdownIntoText",
defaultShortcuts: [], defaultShortcuts: [],
description: "Pastes Markdown from clipboard into text note", description: "Pastes Markdown from clipboard into text note",
scope: "text-detail" scope: "text-detail"
}, },
{ {
actionName: "CutIntoNote", actionName: "cutIntoNote",
defaultShortcuts: [], defaultShortcuts: [],
description: "Cuts the selection from the current note and creates subnote with the selected text", description: "Cuts the selection from the current note and creates subnote with the selected text",
scope: "text-detail" scope: "text-detail"
@ -312,59 +312,59 @@ const DEFAULT_KEYBOARD_ACTIONS = [
}, },
{ {
actionName: "PrintActiveNote", actionName: "printActiveNote",
defaultShortcuts: [], defaultShortcuts: [],
scope: "note-detail" scope: "note-detail"
}, },
{ {
actionName: "RunActiveNote", actionName: "runActiveNote",
defaultShortcuts: ["CommandOrControl+Enter"], defaultShortcuts: ["CommandOrControl+Enter"],
description: "Run active JavaScript (frontend/backend) code note", description: "Run active JavaScript (frontend/backend) code note",
scope: "code-detail" scope: "code-detail"
}, },
{ {
actionName: "ToggleNoteHoisting", actionName: "toggleNoteHoisting",
defaultShortcuts: ["Alt+H"], defaultShortcuts: ["Alt+H"],
description: "Toggles note hoisting of active note", description: "Toggles note hoisting of active note",
scope: "window" scope: "window"
}, },
{ {
actionName: "ReloadFrontendApp", actionName: "reloadFrontendApp",
defaultShortcuts: ["F5", "CommandOrControl+R"], defaultShortcuts: ["F5", "CommandOrControl+R"],
scope: "window" scope: "window"
}, },
{ {
actionName: "OpenDevTools", actionName: "openDevTools",
defaultShortcuts: ["CommandOrControl+Shift+I"], defaultShortcuts: ["CommandOrControl+Shift+I"],
scope: "window" scope: "window"
}, },
{ {
actionName: "FindInText", actionName: "findInText",
defaultShortcuts: ["CommandOrControl+F"], defaultShortcuts: ["CommandOrControl+F"],
scope: "window" scope: "window"
}, },
{ {
actionName: "ToggleFullscreen", actionName: "toggleFullscreen",
defaultShortcuts: ["F11"], defaultShortcuts: ["F11"],
scope: "window" scope: "window"
}, },
{ {
actionName: "ToggleZenMode", actionName: "toggleZenMode",
defaultShortcuts: ["Alt+M"], defaultShortcuts: ["Alt+M"],
scope: "window" scope: "window"
}, },
{ {
actionName: "ZoomOut", actionName: "zoomOut",
defaultShortcuts: ["CommandOrControl+-"], defaultShortcuts: ["CommandOrControl+-"],
scope: "window" scope: "window"
}, },
{ {
actionName: "ZoomIn", actionName: "zoomIn",
defaultShortcuts: ["CommandOrControl+="], defaultShortcuts: ["CommandOrControl+="],
scope: "window" scope: "window"
}, },
{ {
actionName: "CopyWithoutFormatting", actionName: "copyWithoutFormatting",
defaultShortcuts: ["CommandOrControl+Alt+C"], defaultShortcuts: ["CommandOrControl+Alt+C"],
scope: "text-detail" scope: "text-detail"
} }
@ -387,7 +387,8 @@ async function getKeyboardActions() {
for (const option of await optionService.getOptions()) { for (const option of await optionService.getOptions()) {
if (option.name.startsWith('keyboardShortcuts')) { if (option.name.startsWith('keyboardShortcuts')) {
const actionName = option.name.substr(17); let actionName = option.name.substr(17);
actionName = actionName.charAt(0).toLowerCase() + actionName.slice(1);
const action = actions.find(ea => ea.actionName === actionName); const action = actions.find(ea => ea.actionName === actionName);