Skip to content

Commit 4958b89

Browse files
committed
feat(print/list): process notes recursively
1 parent f4b6e9c commit 4958b89

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

apps/client/src/widgets/collections/legacy/ListOrGridView.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,27 @@ export function ListPrintView({ note, noteIds: unfilteredNoteIds, highlightedTok
4848
useLayoutEffect(() => {
4949
froca.getNotes(noteIds).then(async (notes) => {
5050
const notesWithContent: NotesWithContent[] = [];
51-
for (const note of notes) {
51+
52+
async function processNote(note: FNote) {
5253
const content = await content_renderer.getRenderedContent(note, {
5354
trim: false,
5455
noChildrenList: true
5556
});
57+
5658
notesWithContent.push({ note, content: content.$renderedContent[0].innerHTML });
59+
60+
if (note.hasChildren()) {
61+
const imageLinks = note.getRelations("imageLink");
62+
const childNotes = await note.getChildNotes();
63+
const filteredChildNotes = childNotes.filter((childNote) => !imageLinks.find((rel) => rel.value === childNote.noteId));
64+
for (const childNote of filteredChildNotes) {
65+
await processNote(childNote);
66+
}
67+
}
68+
}
69+
70+
for (const note of notes) {
71+
await processNote(note);
5772
}
5873
setNotesWithContent(notesWithContent);
5974
});

0 commit comments

Comments
 (0)