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(tree): open a note from one "Open note" row, as a link does
Elian Dorane68c8a9eeda8
diff --git a/apps/client/src/menus/tree_context_menu.spec.ts b/apps/client/src/menus/tree_context_menu.spec.tsindex d1de9f9b62..b010fa918e 100644--- a/apps/client/src/menus/tree_context_menu.spec.ts+++ b/apps/client/src/menus/tree_context_menu.spec.ts@@ -46,6 +46,19 @@ describe("buildTreeContextMenuItems", () => {]);});+ it("folds the places to open the note in into one split row, quick edit standing on its own", async () => {+ const { build } = setUp();+ const items = await build();+ const separator = items.findIndex((item) => "kind" in item && item.kind === "separator");+ const [ open, quickEdit ] = items.slice(separator + 1);+ if (!open || "kind" in open || !quickEdit || "kind" in quickEdit) throw new Error("expected two rows after the actions");++ expect(open.command).toBe("openInTab");+ expect(open.items?.map((item) => "command" in item && item.command))+ .toStrictEqual([ "openInTab", "openNoteInSplit", "openNoteInWindow" ]);+ expect(quickEdit.command).toBe("openNoteInPopup");+ });+it("protects or unprotects the subtree after Archive, as the note stands, with both in its submenu", async () => {const { child, build } = setUp();diff --git a/apps/client/src/menus/tree_context_menu.ts b/apps/client/src/menus/tree_context_menu.tsindex 3412809b81..97c5a417d7 100644--- a/apps/client/src/menus/tree_context_menu.ts+++ b/apps/client/src/menus/tree_context_menu.ts@@ -185,9 +185,18 @@ export async function buildTreeContextMenuItems(ctx: TreeContextMenuContext): Pr{ kind: "separator" },- { title: t("tree-context-menu.open-in-a-new-tab"), command: "openInTab", shortcut: "Ctrl+Click", uiIcon: "bx bx-link-external", enabled: noSelectedNotes },- { title: t("tree-context-menu.open-in-a-new-split"), command: "openNoteInSplit", uiIcon: "bx bx-dock-right", enabled: noSelectedNotes },- { title: t("tree-context-menu.open-in-a-new-window"), command: "openNoteInWindow", uiIcon: "bx bx-window-open", enabled: noSelectedNotes },+ // As the link context menu has it: the row opens a new tab, its arrow the other places.+ {+ title: t("link_context_menu.open_note"),+ command: "openInTab",+ uiIcon: "bx bx-link-external",+ enabled: noSelectedNotes,+ items: [+ { title: t("tree-context-menu.open-in-a-new-tab"), command: "openInTab", shortcut: "Ctrl+Click", uiIcon: "bx bx-link-external" },+ { title: t("tree-context-menu.open-in-a-new-split"), command: "openNoteInSplit", uiIcon: "bx bx-dock-right" },+ { title: t("tree-context-menu.open-in-a-new-window"), command: "openNoteInWindow", uiIcon: "bx bx-window-open" }+ ]+ },{ title: t("tree-context-menu.open-in-popup"), command: "openNoteInPopup", uiIcon: "bx bx-edit", enabled: noSelectedNotes },isHoisted