mirror of
https://github.com/zadam/trilium.git
synced 2025-12-20 14:24:27 +01:00
feat(breadcrumb): copy note path to clipboard & recent changes in subtree options
This commit is contained in:
parent
0b7ffdf109
commit
d13e19cf59
@ -8,6 +8,7 @@ import NoteContext from "../../components/note_context";
|
|||||||
import FNote from "../../entities/fnote";
|
import FNote from "../../entities/fnote";
|
||||||
import contextMenu from "../../menus/context_menu";
|
import contextMenu from "../../menus/context_menu";
|
||||||
import link_context_menu from "../../menus/link_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 { getReadableTextColor } from "../../services/css_class_manager";
|
||||||
import froca from "../../services/froca";
|
import froca from "../../services/froca";
|
||||||
import hoisted_note from "../../services/hoisted_note";
|
import hoisted_note from "../../services/hoisted_note";
|
||||||
@ -173,6 +174,7 @@ function BreadcrumbItem({ index, notePath, noteContext, notePathLength }: { inde
|
|||||||
if (!note) return;
|
if (!note) return;
|
||||||
|
|
||||||
const notSearch = note?.type !== "search";
|
const notSearch = note?.type !== "search";
|
||||||
|
const notOptionsOrHelp = !note?.noteId.startsWith("_options") && !note?.noteId.startsWith("_help");
|
||||||
const isNotRoot = note?.noteId !== "root";
|
const isNotRoot = note?.noteId !== "root";
|
||||||
const isHoisted = note?.noteId === appContext.tabManager.getActiveContext()?.hoistedNoteId;
|
const isHoisted = note?.noteId === appContext.tabManager.getActiveContext()?.hoistedNoteId;
|
||||||
const parentNote = isNotRoot && branch ? await froca.getNote(branch.parentNoteId) : null;
|
const parentNote = isNotRoot && branch ? await froca.getNote(branch.parentNoteId) : null;
|
||||||
@ -200,6 +202,9 @@ function BreadcrumbItem({ index, notePath, noteContext, notePathLength }: { inde
|
|||||||
uiIcon: "bx bx-duplicate",
|
uiIcon: "bx bx-duplicate",
|
||||||
enabled: isNotRoot && !isHoisted
|
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,
|
x: e.pageX,
|
||||||
y: e.pageY,
|
y: e.pageY,
|
||||||
@ -208,7 +213,15 @@ function BreadcrumbItem({ index, notePath, noteContext, notePathLength }: { inde
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command) {
|
if (!command) return;
|
||||||
|
switch (command) {
|
||||||
|
case "copyNotePathToClipboard":
|
||||||
|
copyTextWithToast(`#${notePath}`);
|
||||||
|
break;
|
||||||
|
case "recentChangesInSubtree":
|
||||||
|
parentComponent?.triggerCommand("showRecentChanges", { ancestorNoteId: noteId });
|
||||||
|
break;
|
||||||
|
default:
|
||||||
parentComponent?.triggerCommand(command, {
|
parentComponent?.triggerCommand(command, {
|
||||||
noteId,
|
noteId,
|
||||||
selectedOrActiveBranchIds: [ branchId ],
|
selectedOrActiveBranchIds: [ branchId ],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user