mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-06 21:21:32 +08:00
29 lines
928 B
JavaScript
29 lines
928 B
JavaScript
![]() |
export default class EqualsExp {
|
||
|
constructor(attributeType, attributeName, attributeValue) {
|
||
|
this.attributeType = attributeType;
|
||
|
this.attributeName = attributeName;
|
||
|
this.attributeValue = attributeValue;
|
||
|
}
|
||
|
|
||
|
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) && attr.value === this.attributeValue) {
|
||
|
if (attr.isInheritable) {
|
||
|
resultNoteSet.addAll(note.subtreeNotesIncludingTemplated);
|
||
|
}
|
||
|
else if (note.isTemplate) {
|
||
|
resultNoteSet.addAll(note.templatedNotes);
|
||
|
}
|
||
|
else {
|
||
|
resultNoteSet.add(note);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|