mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-30 03:32:26 +08:00
28 lines
828 B
JavaScript
28 lines
828 B
JavaScript
![]() |
export default class ExistsExp {
|
||
|
constructor(attributeType, attributeName) {
|
||
|
this.attributeType = attributeType;
|
||
|
this.attributeName = attributeName;
|
||
|
}
|
||
|
|
||
|
execute(noteSet) {
|
||
|
const attrs = findAttributes(this.attributeType, this.attributeName);
|
||
|
const resultNoteSet = new NoteSet();
|
||
|
|
||
|
for (const attr of attrs) {
|
||
|
const note = attr.note;
|
||
|
|
||
|
if (noteSet.hasNoteId(note.noteId)) {
|
||
|
if (attr.isInheritable) {
|
||
|
resultNoteSet.addAll(note.subtreeNotesIncludingTemplated);
|
||
|
}
|
||
|
else if (note.isTemplate) {
|
||
|
resultNoteSet.addAll(note.templatedNotes);
|
||
|
}
|
||
|
else {
|
||
|
resultNoteSet.add(note);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|