Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(touchbar): delete note in note tree
Elian Doranf98ac84829f8
diff --git a/src/public/app/widgets/note_tree.ts b/src/public/app/widgets/note_tree.tsindex 7fc801ecba..961432df92 100644--- a/src/public/app/widgets/note_tree.ts+++ b/src/public/app/widgets/note_tree.ts@@ -25,6 +25,8 @@ import type FNote from "../entities/fnote.js";import type { NoteType } from "../entities/fnote.js";import type { AttributeRow, BranchRow } from "../services/load_results.js";import type { SetNoteOpts } from "../components/note_context.js";+import type { TouchBarItem } from "./touch_bar.js";+import type { TreeCommandNames } from "../menus/tree_context_menu.js";const TPL = /*html*/`<div class="tree-wrapper">@@ -1760,4 +1762,28 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {appContext.tabManager.getActiveContext()?.setNote(resp.note.noteId);}++ buildTouchBarCommand({ TouchBar, buildIcon }: CommandListenerData<"buildTouchBar">) {+ const triggerCommand = (command: TreeCommandNames) => {+ const node = this.getActiveNode();+ const notePath = treeService.getNotePath(node);++ this.triggerCommand<TreeCommandNames>(command, {+ node,+ notePath,+ noteId: node.data.noteId,+ selectedOrActiveBranchIds: this.getSelectedOrActiveBranchIds(node),+ selectedOrActiveNoteIds: this.getSelectedOrActiveNoteIds(node)+ });+ }++ const items: TouchBarItem[] = [+ new TouchBar.TouchBarButton({+ icon: buildIcon("NSImageNameTouchBarDeleteTemplate"),+ click: () => triggerCommand("deleteNotes")+ })+ ];++ return items;+ }}