From a0c025014c1e48376d8c3f8f7574ccc4dbd0b414 Mon Sep 17 00:00:00 2001 From: Jin <22962980+JYC333@users.noreply.github.com> Date: Wed, 19 Mar 2025 15:14:17 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fix=20right=20click=20beh?= =?UTF-8?q?avior?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the bug that when right click on unactive note and do move and clone command, it still gonna move and clone the active note --- src/public/app/components/main_tree_executors.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/public/app/components/main_tree_executors.ts b/src/public/app/components/main_tree_executors.ts index 78251d67c..b5473ffe4 100644 --- a/src/public/app/components/main_tree_executors.ts +++ b/src/public/app/components/main_tree_executors.ts @@ -1,4 +1,4 @@ -import appContext from "./app_context.js"; +import appContext, { type EventData } from "./app_context.js"; import noteCreateService from "../services/note_create.js"; import treeService from "../services/tree.js"; import hoistedNoteService from "../services/hoisted_note.js"; @@ -14,23 +14,19 @@ export default class MainTreeExecutors extends Component { return appContext.noteTreeWidget; } - async cloneNotesToCommand() { + async cloneNotesToCommand({ selectedOrActiveNoteIds }: EventData<"cloneNotesTo">) { if (!this.tree) { return; } - const selectedOrActiveNoteIds = this.tree.getSelectedOrActiveNodes().map((node) => node.data.noteId); - this.triggerCommand("cloneNoteIdsTo", { noteIds: selectedOrActiveNoteIds }); } - async moveNotesToCommand() { + async moveNotesToCommand({ selectedOrActiveBranchIds }: EventData<"moveNotesTo">) { if (!this.tree) { return; } - const selectedOrActiveBranchIds = this.tree.getSelectedOrActiveNodes().map((node) => node.data.branchId); - this.triggerCommand("moveBranchIdsTo", { branchIds: selectedOrActiveBranchIds }); }