From 4958b8963677bb9ab35eab53f814ea3fa9561c9c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 20 Nov 2025 20:31:45 +0200 Subject: [PATCH] feat(print/list): process notes recursively --- .../collections/legacy/ListOrGridView.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx b/apps/client/src/widgets/collections/legacy/ListOrGridView.tsx index 050aa24e3..2970e4e38 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); });