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(breadcrumb): copy note path to clipboard & recent changes in subtree options
Elian Dorand13e19cf594c
diff --git a/apps/client/src/widgets/layout/Breadcrumb.tsx b/apps/client/src/widgets/layout/Breadcrumb.tsxindex be09a1b78e..7cac261f0c 100644--- a/apps/client/src/widgets/layout/Breadcrumb.tsx+++ b/apps/client/src/widgets/layout/Breadcrumb.tsx@@ -8,6 +8,7 @@ import NoteContext from "../../components/note_context";import FNote from "../../entities/fnote";import contextMenu from "../../menus/context_menu";import link_context_menu from "../../menus/link_context_menu";+import { copyTextWithToast } from "../../services/clipboard_ext";import { getReadableTextColor } from "../../services/css_class_manager";import froca from "../../services/froca";import hoisted_note from "../../services/hoisted_note";@@ -173,6 +174,7 @@ function BreadcrumbItem({ index, notePath, noteContext, notePathLength }: { indeif (!note) return;const notSearch = note?.type !== "search";+ const notOptionsOrHelp = !note?.noteId.startsWith("_options") && !note?.noteId.startsWith("_help");const isNotRoot = note?.noteId !== "root";const isHoisted = note?.noteId === appContext.tabManager.getActiveContext()?.hoistedNoteId;const parentNote = isNotRoot && branch ? await froca.getNote(branch.parentNoteId) : null;@@ -200,6 +202,9 @@ function BreadcrumbItem({ index, notePath, noteContext, notePathLength }: { indeuiIcon: "bx bx-duplicate",enabled: isNotRoot && !isHoisted},+ { kind: "separator" },+ { title: t("tree-context-menu.copy-note-path-to-clipboard"), command: "copyNotePathToClipboard", uiIcon: "bx bx-directions", enabled: true },+ { title: t("tree-context-menu.recent-changes-in-subtree"), command: "recentChangesInSubtree", uiIcon: "bx bx-history", enabled: notOptionsOrHelp }],x: e.pageX,y: e.pageY,@@ -208,12 +213,20 @@ function BreadcrumbItem({ index, notePath, noteContext, notePathLength }: { indereturn;}- if (command) {- parentComponent?.triggerCommand(command, {- noteId,- selectedOrActiveBranchIds: [ branchId ],- selectedOrActiveNoteIds: [ noteId ]- });+ if (!command) return;+ switch (command) {+ case "copyNotePathToClipboard":+ copyTextWithToast(`#${notePath}`);+ break;+ case "recentChangesInSubtree":+ parentComponent?.triggerCommand("showRecentChanges", { ancestorNoteId: noteId });+ break;+ default:+ parentComponent?.triggerCommand(command, {+ noteId,+ selectedOrActiveBranchIds: [ branchId ],+ selectedOrActiveNoteIds: [ noteId ]+ });}},});