fixed iconClass and cssClass

This commit is contained in:
zadam 2020-01-25 14:48:53 +01:00
parent ac7d5f2e81
commit 48a7c0235f
5 changed files with 21 additions and 11 deletions

View file

@ -1,4 +1,3 @@
import noteDetailService from '../services/note_detail.js';
import server from '../services/server.js';
import toastService from "../services/toast.js";
import treeService from "../services/tree.js";
@ -7,7 +6,6 @@ import utils from "../services/utils.js";
import linkService from "../services/link.js";
import libraryLoader from "../services/library_loader.js";
import noteAutocompleteService from "../services/note_autocomplete.js";
import treeService from "../services/tree.js";
import appContext from "../services/app_context.js";
const $dialog = $("#attributes-dialog");

View file

@ -1,7 +1,6 @@
import treeService from '../services/tree.js';
import server from '../services/server.js';
import treeCache from "../services/tree_cache.js";
import treeService from "../services/tree.js";
import toastService from "../services/toast.js";
import utils from "../services/utils.js";

View file

@ -1,7 +1,5 @@
import noteAutocompleteService from "../services/note_autocomplete.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 treeCache from "../services/tree_cache.js";
import treeChangesService from "../services/branches.js";

View file

@ -38,11 +38,19 @@ const NOTE_TYPE_ICONS = {
"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) {
const hoistedNoteId = await hoistedNoteService.getHoistedNoteId();
if (note.iconClass) {
return note.iconClass;
const iconClass = await getIconClass(note);
if (iconClass) {
return iconClass;
}
else if (note.noteId === 'root') {
return "bx bx-chevrons-right";
@ -124,6 +132,11 @@ async function prepareSearchBranch(note) {
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) {
utils.assertArguments(note);
@ -137,8 +150,10 @@ async function getExtraClasses(note) {
extraClasses.push("multiple-parents");
}
if (note.cssClass) {
extraClasses.push(note.cssClass);
const cssClass = await getCssClass(note);
if (cssClass) {
extraClasses.push(cssClass);
}
extraClasses.push(utils.getNoteTypeClass(note.type));
@ -147,7 +162,7 @@ async function getExtraClasses(note) {
extraClasses.push(utils.getMimeTypeClass(note.mime));
}
if (note.archived) {
if (await note.hasLabel('archived')) {
extraClasses.push("archived");
}

View file

@ -23,7 +23,7 @@ class WhatLinksHereWidget extends StandardWidget {
}
async refreshWithNote() {
const targetRelations = await this.tabContext.note.getTargetRelations();
const targetRelations = this.tabContext.note.getTargetRelations();
if (targetRelations.length === 0) {
this.$body.text("Nothing links here yet ...");