Skip to content

Build your personal knowledge base with Trilium Notes

feat(in-app-help): integrate into existing help command

Elian Dorane24013adf5cb
diff --git a/src/public/app/components/root_command_executor.ts b/src/public/app/components/root_command_executor.ts
index 899bfebd2e..49ea7d8782 100644
--- a/src/public/app/components/root_command_executor.ts
+++ b/src/public/app/components/root_command_executor.ts
@@ -90,6 +90,10 @@ export default class RootCommandExecutor extends Component {
await appContext.tabManager.openTabWithNoteWithHoisting("_backendLog", { activate: true });
}
+ async showHelpCommand() {
+ await appContext.tabManager.openTabWithNoteWithHoisting("_help", { activate: true });
+ }
+
async showLaunchBarSubtreeCommand() {
const rootNote = utils.isMobile() ? "_lbMobileRoot" : "_lbRoot";
await this.showAndHoistSubtree(rootNote);
diff --git a/src/public/app/widgets/buttons/global_menu.ts b/src/public/app/widgets/buttons/global_menu.ts
index f620108eb3..e34313bfc6 100644
--- a/src/public/app/widgets/buttons/global_menu.ts
+++ b/src/public/app/widgets/buttons/global_menu.ts
@@ -226,6 +226,12 @@ const TPL = `
<kbd data-command="showHelp"></kbd>
</li>
+ <li class="dropdown-item show-help-button" data-trigger-command="showCheatsheet">
+ <span class="bx bx-help-circle"></span>
+ ${t("global_menu.show-cheatsheet")}
+ <kbd data-command="showCheatsheet"></kbd>
+ </li>
+
<li class="dropdown-item show-about-dialog-button">
<span class="bx bx-info-circle"></span>
${t("global_menu.about")}
diff --git a/src/public/app/widgets/dialogs/help.ts b/src/public/app/widgets/dialogs/help.ts
index 860ccc4d92..4257a13678 100644
--- a/src/public/app/widgets/dialogs/help.ts
+++ b/src/public/app/widgets/dialogs/help.ts
@@ -153,7 +153,7 @@ export default class HelpDialog extends BasicWidget {
this.$widget = $(TPL);
}
- showHelpEvent() {
+ showCheatsheetEvent() {
utils.openDialog(this.$widget);
}
}
diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json
index 958df556bc..956dbba403 100644
--- a/src/public/translations/en/translation.json
+++ b/src/public/translations/en/translation.json
@@ -641,7 +641,8 @@
"show_hidden_subtree": "Show Hidden Subtree",
"show_help": "Show Help",
"about": "About TriliumNext Notes",
- "logout": "Logout"
+ "logout": "Logout",
+ "show-cheatsheet": "Show Cheatsheet"
},
"sync_status": {
"unknown": "<p>Sync status will be known once the next sync attempt starts.</p><p>Click to trigger sync now.</p>",
diff --git a/src/services/keyboard_actions.ts b/src/services/keyboard_actions.ts
index 8d96a915f4..21745878db 100644
--- a/src/services/keyboard_actions.ts
+++ b/src/services/keyboard_actions.ts
@@ -344,6 +344,12 @@ function getDefaultKeyboardActions() {
description: t("keyboard_actions.show-help"),
scope: "window"
},
+ {
+ actionName: "showCheatsheet",
+ defaultShortcuts: ["Shift+F1"],
+ description: t("keyboard_actions.show-cheatsheet"),
+ scope: "window"
+ },
{
separator: t("keyboard_actions.text-note-operations")
diff --git a/src/services/keyboard_actions_interface.ts b/src/services/keyboard_actions_interface.ts
index 68d7083093..9eb3539bd5 100644
--- a/src/services/keyboard_actions_interface.ts
+++ b/src/services/keyboard_actions_interface.ts
@@ -51,6 +51,7 @@ const enum KeyboardActionNamesEnum {
showRecentChanges,
showSQLConsole,
showBackendLog,
+ showCheatsheet,
showHelp,
addLinkToText,
followLinkUnderCursor,
diff --git a/translations/en/server.json b/translations/en/server.json
index 1722281718..0560c59762 100644
--- a/translations/en/server.json
+++ b/translations/en/server.json
@@ -88,10 +88,11 @@
"reset-zoom-level": "Reset zoom level",
"copy-without-formatting": "Copy selected text without formatting",
"force-save-revision": "Force creating / saving new note revision of the active note",
- "show-help": "Shows built-in Help / cheatsheet",
+ "show-help": "Shows the built-in User Guide",
"toggle-book-properties": "Toggle Book Properties",
"toggle-classic-editor-toolbar": "Toggle the Formatting tab for the editor with fixed toolbar",
- "export-as-pdf": "Exports the current note as a PDF"
+ "export-as-pdf": "Exports the current note as a PDF",
+ "show-cheatsheet": "Shows a modal with common keyboard operations"
},
"login": {
"title": "Login",