mirror of
https://github.com/zadam/trilium.git
synced 2025-11-13 16:55:50 +01:00
small visual tweaks to link map, including displaying the note icon
This commit is contained in:
@@ -5,6 +5,16 @@ import noteAttributeCache from "../services/note_attribute_cache.js";
|
||||
const LABEL = 'label';
|
||||
const RELATION = 'relation';
|
||||
|
||||
const NOTE_TYPE_ICONS = {
|
||||
"file": "bx bx-file",
|
||||
"image": "bx bx-image",
|
||||
"code": "bx bx-code",
|
||||
"render": "bx bx-extension",
|
||||
"search": "bx bx-file-find",
|
||||
"relation-map": "bx bx-map-alt",
|
||||
"book": "bx bx-book"
|
||||
};
|
||||
|
||||
/**
|
||||
* FIXME: since there's no "full note" anymore we can rename this to Note
|
||||
*
|
||||
@@ -254,6 +264,31 @@ class NoteShort {
|
||||
return this.getAttributes(LABEL, name);
|
||||
}
|
||||
|
||||
getIcon(isFolder = false) {
|
||||
const iconCassLabels = this.getLabels('iconClass');
|
||||
|
||||
if (iconCassLabels.length > 0) {
|
||||
return iconCassLabels.map(l => l.value).join(' ');
|
||||
}
|
||||
else if (this.noteId === 'root') {
|
||||
return "bx bx-chevrons-right";
|
||||
}
|
||||
else if (this.type === 'text') {
|
||||
if (isFolder) {
|
||||
return "bx bx-folder";
|
||||
}
|
||||
else {
|
||||
return "bx bx-note";
|
||||
}
|
||||
}
|
||||
else if (this.type === 'code' && this.mime.startsWith('text/x-sql')) {
|
||||
return "bx bx-data";
|
||||
}
|
||||
else {
|
||||
return NOTE_TYPE_ICONS[this.type];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} [name] - relation name to filter
|
||||
* @returns {Attribute[]} all note's relations (attributes with type relation), including inherited ones
|
||||
|
||||
Reference in New Issue
Block a user