mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
make "excludeFromNoteMap" overridable with note.isLabelTruthy(), #4058
This commit is contained in:
parent
dd8226ff4c
commit
430f2975f8
@ -57,7 +57,7 @@ function getNeighbors(note, depth) {
|
|||||||
|
|
||||||
const targetNote = relation.getTargetNote();
|
const targetNote = relation.getTargetNote();
|
||||||
|
|
||||||
if (!targetNote || targetNote.hasLabel('excludeFromNoteMap')) {
|
if (!targetNote || targetNote.isLabelTruthy('excludeFromNoteMap')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ function getNeighbors(note, depth) {
|
|||||||
|
|
||||||
const sourceNote = relation.getNote();
|
const sourceNote = relation.getNote();
|
||||||
|
|
||||||
if (!sourceNote || sourceNote.hasLabel('excludeFromNoteMap')) {
|
if (!sourceNote || sourceNote.isLabelTruthy('excludeFromNoteMap')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ function getLinkMap(req) {
|
|||||||
const mapRootNote = becca.getNote(req.params.noteId);
|
const mapRootNote = becca.getNote(req.params.noteId);
|
||||||
// if the map root itself has exclude attribute (journal typically) then there wouldn't be anything to display, so
|
// if the map root itself has exclude attribute (journal typically) then there wouldn't be anything to display, so
|
||||||
// we'll just ignore it
|
// we'll just ignore it
|
||||||
const ignoreExcludeFromNoteMap = mapRootNote.hasLabel('excludeFromNoteMap');
|
const ignoreExcludeFromNoteMap = mapRootNote.isLabelTruthy('excludeFromNoteMap');
|
||||||
let unfilteredNotes;
|
let unfilteredNotes;
|
||||||
|
|
||||||
if (mapRootNote.type === 'search') {
|
if (mapRootNote.type === 'search') {
|
||||||
@ -110,7 +110,7 @@ function getLinkMap(req) {
|
|||||||
|
|
||||||
const noteIds = new Set(
|
const noteIds = new Set(
|
||||||
unfilteredNotes
|
unfilteredNotes
|
||||||
.filter(note => ignoreExcludeFromNoteMap || !note.hasLabel('excludeFromNoteMap'))
|
.filter(note => ignoreExcludeFromNoteMap || !note.isLabelTruthy('excludeFromNoteMap'))
|
||||||
.map(note => note.noteId)
|
.map(note => note.noteId)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ function getTreeMap(req) {
|
|||||||
const mapRootNote = becca.getNote(req.params.noteId);
|
const mapRootNote = becca.getNote(req.params.noteId);
|
||||||
// if the map root itself has ignore (journal typically) then there wouldn't be anything to display, so
|
// if the map root itself has ignore (journal typically) then there wouldn't be anything to display, so
|
||||||
// we'll just ignore it
|
// we'll just ignore it
|
||||||
const ignoreExcludeFromNoteMap = mapRootNote.hasLabel('excludeFromNoteMap');
|
const ignoreExcludeFromNoteMap = mapRootNote.isLabelTruthy('excludeFromNoteMap');
|
||||||
const subtree = mapRootNote.getSubtree({
|
const subtree = mapRootNote.getSubtree({
|
||||||
includeArchived: false,
|
includeArchived: false,
|
||||||
resolveSearch: true,
|
resolveSearch: true,
|
||||||
@ -177,7 +177,7 @@ function getTreeMap(req) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const notes = subtree.notes
|
const notes = subtree.notes
|
||||||
.filter(note => ignoreExcludeFromNoteMap || !note.hasLabel('excludeFromNoteMap'))
|
.filter(note => ignoreExcludeFromNoteMap || !note.isLabelTruthy('excludeFromNoteMap'))
|
||||||
.filter(note => {
|
.filter(note => {
|
||||||
if (note.type !== 'image' || note.getChildNotes().length > 0) {
|
if (note.type !== 'image' || note.getChildNotes().length > 0) {
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user