Skip to content

Build your personal knowledge base with Trilium Notes

fix(client): unable to trigger move to dialog via keyboard shortcut

Elian Doran2ad834fe5bd5
diff --git a/docs/Release Notes/Release Notes/v0.93.0.md b/docs/Release Notes/Release Notes/v0.93.0.md
index dfa83b73b2..8015bd79e5 100644
--- a/docs/Release Notes/Release Notes/v0.93.0.md
+++ b/docs/Release Notes/Release Notes/v0.93.0.md
@@ -16,6 +16,7 @@
* [Return correct HTTP status code on failed login attempts instead of 200](https://github.com/TriliumNext/Notes/issues/1707) by @pano9000
* [Calendar stops displaying notes after adding a Day Note](https://github.com/TriliumNext/Notes/issues/1705)
* Full anonymization not redacting attachment titles.
+* Unable to trigger "Move to" dialog via keyboard shortcut.
## ✨ Improvements
diff --git a/src/public/app/components/app_context.ts b/src/public/app/components/app_context.ts
index 68f50218af..ff1f3fa500 100644
--- a/src/public/app/components/app_context.ts
+++ b/src/public/app/components/app_context.ts
@@ -53,8 +53,8 @@ export interface ContextMenuCommandData extends CommandData {
node: Fancytree.FancytreeNode;
notePath?: string;
noteId?: string;
- selectedOrActiveBranchIds?: any; // TODO: Remove any once type is defined
- selectedOrActiveNoteIds: any; // TODO: Remove any once type is defined
+ selectedOrActiveBranchIds: string[];
+ selectedOrActiveNoteIds?: string[];
}
export interface NoteCommandData extends CommandData {
diff --git a/src/public/app/components/main_tree_executors.ts b/src/public/app/components/main_tree_executors.ts
index 984da0656b..9bc037ccf3 100644
--- a/src/public/app/components/main_tree_executors.ts
+++ b/src/public/app/components/main_tree_executors.ts
@@ -18,10 +18,26 @@ export default class MainTreeExecutors extends Component {
}
async cloneNotesToCommand({ selectedOrActiveNoteIds }: EventData<"cloneNotesTo">) {
+ if (!selectedOrActiveNoteIds && this.tree) {
+ selectedOrActiveNoteIds = this.tree.getSelectedOrActiveNodes().map((node) => node.data.noteId);
+ }
+
+ if (!selectedOrActiveNoteIds) {
+ return;
+ }
+
this.triggerCommand("cloneNoteIdsTo", { noteIds: selectedOrActiveNoteIds });
}
async moveNotesToCommand({ selectedOrActiveBranchIds }: EventData<"moveNotesTo">) {
+ if (!selectedOrActiveBranchIds && this.tree) {
+ selectedOrActiveBranchIds = this.tree.getSelectedOrActiveNodes().map((node) => node.data.branchId);
+ }
+
+ if (!selectedOrActiveBranchIds) {
+ return;
+ }
+
this.triggerCommand("moveBranchIdsTo", { branchIds: selectedOrActiveBranchIds });
}