Skip to content

Build your personal knowledge base with Trilium Notes

fix(command_palette): text editor-based issues not working

Elian Doran11d086ef12a4
diff --git a/apps/client/src/services/command_registry.ts b/apps/client/src/services/command_registry.ts
index a8721e43f3..e3ffb36a4f 100644
--- a/apps/client/src/services/command_registry.ts
+++ b/apps/client/src/services/command_registry.ts
@@ -244,6 +244,8 @@ class CommandRegistry {
if (command.keyboardAction && command.commandName) {
if (command.keyboardAction.scope === "note-tree") {
this.executeWithNoteTreeFocus(command.commandName);
+ } else if (command.keyboardAction.scope === "text-detail") {
+ this.executeWithTextDetail(command.commandName);
} else {
appContext.triggerCommand(command.commandName);
}
@@ -272,6 +274,17 @@ class CommandRegistry {
node: activeNode
});
}
+
+ private async executeWithTextDetail(actionName: CommandNames) {
+ const typeWidget = await appContext.tabManager.getActiveContext()?.getTypeWidget();
+ if (!typeWidget) {
+ return;
+ }
+
+ typeWidget.triggerCommand(actionName, {
+ ntxId: appContext.tabManager.activeNtxId
+ });
+ }
}
const commandRegistry = new CommandRegistry();