mirror of
https://github.com/zadam/trilium.git
synced 2025-11-21 08:04:24 +01:00
feat(print/list): process notes recursively
This commit is contained in:
parent
f4b6e9c25a
commit
4958b89636
@ -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);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user