Skip to content

Build your personal knowledge base with Trilium Notes

feat(print/list): process notes recursively

Elian Doran4958b8963677
diff --git a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx
index 050aa24e3b..2970e4e38c 100644
--- a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx
+++ b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx
@@ -48,12 +48,27 @@ export function ListPrintView({ note, noteIds: unfilteredNoteIds, highlightedTok
useLayoutEffect(() => {
froca.getNotes(noteIds).then(async (notes) => {
const notesWithContent: NotesWithContent[] = [];
- for (const note of notes) {
+
+ async function processNote(note: FNote) {
const content = await content_renderer.getRenderedContent(note, {
trim: false,
noChildrenList: true
});
+
notesWithContent.push({ note, content: content.$renderedContent[0].innerHTML });
+
+ if (note.hasChildren()) {
+ const imageLinks = note.getRelations("imageLink");
+ const childNotes = await note.getChildNotes();
+ const filteredChildNotes = childNotes.filter((childNote) => !imageLinks.find((rel) => rel.value === childNote.noteId));
+ for (const childNote of filteredChildNotes) {
+ await processNote(childNote);
+ }
+ }
+ }
+
+ for (const note of notes) {
+ await processNote(note);
}
setNotesWithContent(notesWithContent);
});