feat(print): add links to print report

This commit is contained in:
Elian Doran 2025-12-24 18:59:50 +02:00
parent 293ef60350
commit c2214493dc
No known key found for this signature in database
2 changed files with 26 additions and 4 deletions

View File

@ -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"

View File

@ -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>
);
}
}
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>
);
}