mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 10:55:55 +01:00
Link entity migrated to Attribute, WIP
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import server from '../services/server.js';
|
||||
import Attribute from './attribute.js';
|
||||
import Link from './link.js';
|
||||
|
||||
const LABEL = 'label';
|
||||
const LABEL_DEFINITION = 'label-definition';
|
||||
@@ -84,7 +86,8 @@ class NoteShort {
|
||||
*/
|
||||
async getAttributes(name) {
|
||||
if (!this.attributeCache) {
|
||||
this.attributeCache = await server.get('notes/' + this.noteId + '/attributes');
|
||||
this.attributeCache = (await server.get('notes/' + this.noteId + '/attributes'))
|
||||
.map(attrRow => new Attribute(this.treeCache, attrRow));
|
||||
}
|
||||
|
||||
if (name) {
|
||||
@@ -227,6 +230,14 @@ class NoteShort {
|
||||
this.attributeCache = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {Promise<Link[]>}
|
||||
*/
|
||||
async getLinks() {
|
||||
return (await server.get('notes/' + this.noteId + '/links'))
|
||||
.map(linkRow => new Link(this.treeCache, linkRow));
|
||||
}
|
||||
|
||||
get toString() {
|
||||
return `Note(noteId=${this.noteId}, title=${this.title})`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user