diff --git a/src/public/app/components/app_context.ts b/src/public/app/components/app_context.ts index cde4f217a..079e9f737 100644 --- a/src/public/app/components/app_context.ts +++ b/src/public/app/components/app_context.ts @@ -173,9 +173,9 @@ export type CommandMappings = { callback: (value: NoteDetailWidget | PromiseLike) => void; }; executeWithTextEditor: CommandData & - ExecuteCommandData & { - callback?: GetTextEditorCallback; - }; + ExecuteCommandData & { + callback?: GetTextEditorCallback; + }; executeWithCodeEditor: CommandData & ExecuteCommandData; /** * Called upon when attempting to retrieve the content element of a {@link NoteContext}. @@ -364,6 +364,12 @@ type EventMappings = { textTypeWidget: EditableTextTypeWidget; text: string; }; + openBulkActionsDialog: { + selectedOrActiveNoteIds: string[]; + }; + cloneNoteIdsTo: { + noteIds: string[]; + }; }; export type EventListener = { 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 }); } diff --git a/src/public/app/widgets/dialogs/branch_prefix.js b/src/public/app/widgets/dialogs/branch_prefix.ts similarity index 79% rename from src/public/app/widgets/dialogs/branch_prefix.js rename to src/public/app/widgets/dialogs/branch_prefix.ts index 0f0dcd02d..46a014e6c 100644 --- a/src/public/app/widgets/dialogs/branch_prefix.js +++ b/src/public/app/widgets/dialogs/branch_prefix.ts @@ -8,8 +8,6 @@ import appContext from "../../components/app_context.js"; import { t } from "../../services/i18n.js"; import { Modal } from "bootstrap"; -let branchId; - const TPL = ` @@ -38,61 +36,70 @@ const TPL = `