mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fixed iconClass and cssClass
This commit is contained in:
parent
ac7d5f2e81
commit
48a7c0235f
@ -1,4 +1,3 @@
|
|||||||
import noteDetailService from '../services/note_detail.js';
|
|
||||||
import server from '../services/server.js';
|
import server from '../services/server.js';
|
||||||
import toastService from "../services/toast.js";
|
import toastService from "../services/toast.js";
|
||||||
import treeService from "../services/tree.js";
|
import treeService from "../services/tree.js";
|
||||||
@ -7,7 +6,6 @@ import utils from "../services/utils.js";
|
|||||||
import linkService from "../services/link.js";
|
import linkService from "../services/link.js";
|
||||||
import libraryLoader from "../services/library_loader.js";
|
import libraryLoader from "../services/library_loader.js";
|
||||||
import noteAutocompleteService from "../services/note_autocomplete.js";
|
import noteAutocompleteService from "../services/note_autocomplete.js";
|
||||||
import treeService from "../services/tree.js";
|
|
||||||
import appContext from "../services/app_context.js";
|
import appContext from "../services/app_context.js";
|
||||||
|
|
||||||
const $dialog = $("#attributes-dialog");
|
const $dialog = $("#attributes-dialog");
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import treeService from '../services/tree.js';
|
import treeService from '../services/tree.js';
|
||||||
import server from '../services/server.js';
|
import server from '../services/server.js';
|
||||||
import treeCache from "../services/tree_cache.js";
|
import treeCache from "../services/tree_cache.js";
|
||||||
import treeService from "../services/tree.js";
|
|
||||||
import toastService from "../services/toast.js";
|
import toastService from "../services/toast.js";
|
||||||
import utils from "../services/utils.js";
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import noteAutocompleteService from "../services/note_autocomplete.js";
|
import noteAutocompleteService from "../services/note_autocomplete.js";
|
||||||
import utils from "../services/utils.js";
|
import utils from "../services/utils.js";
|
||||||
import cloningService from "../services/cloning.js";
|
|
||||||
import treeService from "../services/tree.js";
|
|
||||||
import toastService from "../services/toast.js";
|
import toastService from "../services/toast.js";
|
||||||
import treeCache from "../services/tree_cache.js";
|
import treeCache from "../services/tree_cache.js";
|
||||||
import treeChangesService from "../services/branches.js";
|
import treeChangesService from "../services/branches.js";
|
||||||
|
@ -38,11 +38,19 @@ const NOTE_TYPE_ICONS = {
|
|||||||
"book": "bx bx-book"
|
"book": "bx bx-book"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async function getIconClass(note) {
|
||||||
|
const labels = await note.getLabels('iconClass');
|
||||||
|
|
||||||
|
return labels.map(l => l.value).join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
async function getIcon(note) {
|
async function getIcon(note) {
|
||||||
const hoistedNoteId = await hoistedNoteService.getHoistedNoteId();
|
const hoistedNoteId = await hoistedNoteService.getHoistedNoteId();
|
||||||
|
|
||||||
if (note.iconClass) {
|
const iconClass = await getIconClass(note);
|
||||||
return note.iconClass;
|
|
||||||
|
if (iconClass) {
|
||||||
|
return iconClass;
|
||||||
}
|
}
|
||||||
else if (note.noteId === 'root') {
|
else if (note.noteId === 'root') {
|
||||||
return "bx bx-chevrons-right";
|
return "bx bx-chevrons-right";
|
||||||
@ -124,6 +132,11 @@ async function prepareSearchBranch(note) {
|
|||||||
return await prepareRealBranch(newNote);
|
return await prepareRealBranch(newNote);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getCssClass(note) {
|
||||||
|
const labels = await note.getLabels('cssClass');
|
||||||
|
return labels.map(l => l.value).join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
async function getExtraClasses(note) {
|
async function getExtraClasses(note) {
|
||||||
utils.assertArguments(note);
|
utils.assertArguments(note);
|
||||||
|
|
||||||
@ -137,8 +150,10 @@ async function getExtraClasses(note) {
|
|||||||
extraClasses.push("multiple-parents");
|
extraClasses.push("multiple-parents");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note.cssClass) {
|
const cssClass = await getCssClass(note);
|
||||||
extraClasses.push(note.cssClass);
|
|
||||||
|
if (cssClass) {
|
||||||
|
extraClasses.push(cssClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
extraClasses.push(utils.getNoteTypeClass(note.type));
|
extraClasses.push(utils.getNoteTypeClass(note.type));
|
||||||
@ -147,7 +162,7 @@ async function getExtraClasses(note) {
|
|||||||
extraClasses.push(utils.getMimeTypeClass(note.mime));
|
extraClasses.push(utils.getMimeTypeClass(note.mime));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note.archived) {
|
if (await note.hasLabel('archived')) {
|
||||||
extraClasses.push("archived");
|
extraClasses.push("archived");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class WhatLinksHereWidget extends StandardWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async refreshWithNote() {
|
async refreshWithNote() {
|
||||||
const targetRelations = await this.tabContext.note.getTargetRelations();
|
const targetRelations = this.tabContext.note.getTargetRelations();
|
||||||
|
|
||||||
if (targetRelations.length === 0) {
|
if (targetRelations.length === 0) {
|
||||||
this.$body.text("Nothing links here yet ...");
|
this.$body.text("Nothing links here yet ...");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user