Skip to content

Build your personal knowledge base with Trilium Notes

feat(print): add links to print report

Elian Doranc2214493dc76
diff --git a/apps/client/src/widgets/NoteDetail.tsx b/apps/client/src/widgets/NoteDetail.tsx
index 4ad3743444..e902a400e9 100644
--- a/apps/client/src/widgets/NoteDetail.tsx
+++ b/apps/client/src/widgets/NoteDetail.tsx
@@ -14,7 +14,7 @@ import toast from "../services/toast.js";
import { dynamicRequire, isElectron, isMobile } from "../services/utils";
import { ExtendedNoteType, TYPE_MAPPINGS, TypeWidget } from "./note_types";
import { useNoteContext, useTriliumEvent } from "./react/hooks";
-import NoteList from "./react/NoteList";
+import { NoteListWithLinks } from "./react/NoteList";
import { TypeWidgetProps } from "./type_widgets/type_widget";
/**
@@ -200,7 +200,7 @@ export default function NoteDetail() {
api.dismissToast();
dialog.info(<>
<h3>{t("note_detail.print_report_collection_details_ignored_notes")}</h3>
- <NoteList noteIds={printReport.ignoredNoteIds} />
+ <NoteListWithLinks noteIds={printReport.ignoredNoteIds} />
</>, {
title: t("note_detail.print_report_title"),
size: "md"
diff --git a/apps/client/src/widgets/react/NoteList.tsx b/apps/client/src/widgets/react/NoteList.tsx
index 59a9f858b6..9f8e585f7b 100644
--- a/apps/client/src/widgets/react/NoteList.tsx
+++ b/apps/client/src/widgets/react/NoteList.tsx
@@ -1,7 +1,9 @@
+import type { CSSProperties } from "preact/compat";
import { useEffect, useState } from "preact/hooks";
+
import type FNote from "../../entities/fnote";
import froca from "../../services/froca";
-import type { CSSProperties } from "preact/compat";
+import NoteLink from "./NoteLink";
interface NoteListProps {
noteIds?: string[];
@@ -33,4 +35,24 @@ export default function NoteList({ noteIds, branchIds, style }: NoteListProps) {
))}
</ul>
);
-}
\ No newline at end of file
+}
+
+export function NoteListWithLinks({ noteIds }: {
+ noteIds: string[]
+}) {
+ const [ notes, setNotes ] = useState<FNote[]>([]);
+
+ useEffect(() => {
+ froca.getNotes(noteIds).then((notes) => setNotes(notes));
+ }, [ noteIds ]);
+
+ return (notes &&
+ <ul>
+ {notes.map(note => (
+ <li key={note.noteId}>
+ <NoteLink notePath={note.noteId} showNotePath showNoteIcon noPreview />
+ </li>
+ ))}
+ </ul>
+ );
+}