diff --git a/src/public/javascripts/dialogs/attributes.js b/src/public/javascripts/dialogs/attributes.js index 2677d84a5..35f2eaf5a 100644 --- a/src/public/javascripts/dialogs/attributes.js +++ b/src/public/javascripts/dialogs/attributes.js @@ -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"); diff --git a/src/public/javascripts/dialogs/branch_prefix.js b/src/public/javascripts/dialogs/branch_prefix.js index 0b6112b8d..2ad7ba247 100644 --- a/src/public/javascripts/dialogs/branch_prefix.js +++ b/src/public/javascripts/dialogs/branch_prefix.js @@ -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"; diff --git a/src/public/javascripts/dialogs/move_to.js b/src/public/javascripts/dialogs/move_to.js index 125eb36f6..ec5633a28 100644 --- a/src/public/javascripts/dialogs/move_to.js +++ b/src/public/javascripts/dialogs/move_to.js @@ -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"; diff --git a/src/public/javascripts/services/tree_builder.js b/src/public/javascripts/services/tree_builder.js index eda30b55a..41f4f9c31 100644 --- a/src/public/javascripts/services/tree_builder.js +++ b/src/public/javascripts/services/tree_builder.js @@ -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"); } diff --git a/src/public/javascripts/widgets/what_links_here.js b/src/public/javascripts/widgets/what_links_here.js index 0920ddaf1..ebe1b4c31 100644 --- a/src/public/javascripts/widgets/what_links_here.js +++ b/src/public/javascripts/widgets/what_links_here.js @@ -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 ...");