added getTargetNote to froca's attribute, fixes #2981

This commit is contained in:
zadam
2022-07-11 23:15:16 +02:00
parent ea20d23d11
commit 377922eccf
7 changed files with 398 additions and 61 deletions

View File

@@ -61,8 +61,19 @@ class Attribute {
return this.froca.notes[this.noteId];
}
/** @returns {Promise<NoteShort>} */
async getTargetNote() {
const targetNoteId = this.targetNoteId;
return await this.froca.getNote(targetNoteId, true);
}
get targetNoteId() { // alias
return this.type === 'relation' ? this.value : undefined;
if (this.type !== 'relation') {
throw new Error(`Attribute ${this.attributeId} is not a relation`);
}
return this.value;
}
get isAutoLink() {