refactor(server): typed keyboard action names

This commit is contained in:
Elian Doran 2025-01-03 00:59:38 +02:00
parent 728037075f
commit a9ea3c8b63
No known key found for this signature in database
2 changed files with 99 additions and 2 deletions

View File

@ -462,6 +462,7 @@ function getDefaultKeyboardActions() {
description: t("keyboard_actions.toggle-inherited-attributes"),
scope: "window"
},
// TODO: Remove or change since promoted attributes have been changed.
{
actionName: "toggleRibbonTabPromotedAttributes",
defaultShortcuts: [],

View File

@ -1,6 +1,102 @@
const enum KeyboardActionNamesEnum {
backInNoteHistory,
forwardInNoteHistory,
jumpToNote,
scrollToActiveNote,
quickSearch,
searchInSubtree,
expandSubtree,
collapseTree,
collapseSubtree,
sortChildNotes,
createNoteAfter,
createNoteInto,
createNoteIntoInbox,
deleteNotes,
moveNoteUp,
moveNoteDown,
moveNoteUpInHierarchy,
moveNoteDownInHierarchy,
editNoteTitle,
editBranchPrefix,
cloneNotesTo,
moveNotesTo,
copyNotesToClipboard,
pasteNotesFromClipboard,
cutNotesToClipboard,
selectAllNotesInParent,
addNoteAboveToSelection,
addNoteBelowToSelection,
duplicateSubtree,
openNewTab,
closeActiveTab,
reopenLastTab,
activateNextTab,
activatePreviousTab,
openNewWindow,
toggleTray,
firstTab,
secondTab,
thirdTab,
fourthTab,
fifthTab,
sixthTab,
seventhTab,
eigthTab,
ninthTab,
lastTab,
showNoteSource,
showOptions,
showRevisions,
showRecentChanges,
showSQLConsole,
showBackendLog,
showHelp,
addLinkToText,
followLinkUnderCursor,
insertDateTimeToText,
pasteMarkdownIntoText,
cutIntoNote,
addIncludeNoteToText,
editReadOnlyNote,
addNewLabel,
addNewRelation,
toggleRibbonTabClassicEditor,
toggleRibbonTabBasicProperties,
toggleRibbonTabBookProperties,
toggleRibbonTabFileProperties,
toggleRibbonTabImageProperties,
toggleRibbonTabOwnedAttributes,
toggleRibbonTabInheritedAttributes,
toggleRibbonTabPromotedAttributes,
toggleRibbonTabNoteMap,
toggleRibbonTabNoteInfo,
toggleRibbonTabNotePaths,
toggleRibbonTabSimilarNotes,
toggleRightPane,
printActiveNote,
openNoteExternally,
renderActiveNote,
runActiveNote,
toggleNoteHoisting,
unhoist,
reloadFrontendApp,
openDevTools,
findInText,
toggleLeftPane,
toggleFullscreen,
zoomOut,
zoomIn,
zoomReset,
copyWithoutFormatting,
forceSaveRevision
}
type KeyboardActionNames = keyof typeof KeyboardActionNamesEnum;
export interface KeyboardShortcut {
separator?: string;
actionName?: string;
actionName?: KeyboardActionNames;
description?: string;
defaultShortcuts?: string[];
effectiveShortcuts?: string[];
@ -16,5 +112,5 @@ export interface KeyboardShortcut {
}
export interface KeyboardShortcutWithRequiredActionName extends KeyboardShortcut {
actionName: string;
actionName: KeyboardActionNames;
}