tweaks to note map

This commit is contained in:
zadam
2021-09-21 22:45:06 +02:00
parent b0d767df69
commit 208492bee1
3 changed files with 38 additions and 22 deletions

View File

@@ -151,6 +151,19 @@ function getGlobalTreeMap(req) {
const notes = mapRootNote.getSubtreeNotes(false)
.filter(note => !note.hasLabel('excludeFromTreeMap'))
.filter(note => {
if (note.type !== 'image' || note.getChildNotes().length > 0) {
return true;
}
const imageLinkRelation = note.getTargetRelations().find(rel => rel.name === 'imageLink');
if (!imageLinkRelation) {
return true;
}
return !note.getParentNotes().find(parentNote => parentNote.noteId === imageLinkRelation.noteId);
})
.map(note => [
note.noteId,
note.isContentAvailable() ? note.title : '[protected]',
@@ -169,8 +182,7 @@ function getGlobalTreeMap(req) {
links.push({
id: branch.branchId,
sourceNoteId: branch.parentNoteId,
targetNoteId: branch.noteId,
name: 'branch'
targetNoteId: branch.noteId
});
}