diff --git a/src/public/javascripts/entities/note_short.js b/src/public/javascripts/entities/note_short.js index 9d2ce7eb3..884f4c6b3 100644 --- a/src/public/javascripts/entities/note_short.js +++ b/src/public/javascripts/entities/note_short.js @@ -407,7 +407,7 @@ class NoteShort { * @returns {Promise} */ async getRelationTargets(name) { - const relations = await this.getRelations(name); + const relations = this.getRelations(name); const targets = []; for (const relation of relations) { @@ -446,8 +446,8 @@ class NoteShort { return dto; } - async getCssClass() { - const labels = await this.getLabels('cssClass'); + getCssClass() { + const labels = this.getLabels('cssClass'); return labels.map(l => l.value).join(' '); } } diff --git a/src/public/javascripts/services/note_content_renderer.js b/src/public/javascripts/services/note_content_renderer.js index 0a4840026..4dbc9509e 100644 --- a/src/public/javascripts/services/note_content_renderer.js +++ b/src/public/javascripts/services/note_content_renderer.js @@ -77,7 +77,7 @@ async function getRenderedContent(note) { $rendered = $("Content of this note cannot be displayed in the book format"); } - $rendered.addClass(await note.getCssClass()); + $rendered.addClass(note.getCssClass()); return { renderedContent: $rendered, diff --git a/src/public/javascripts/services/render.js b/src/public/javascripts/services/render.js index 5552d2386..a0ddd7545 100644 --- a/src/public/javascripts/services/render.js +++ b/src/public/javascripts/services/render.js @@ -2,7 +2,7 @@ import server from "./server.js"; import bundleService from "./bundle.js"; async function render(note, $el) { - const relations = await note.getRelations('renderNote'); + const relations = note.getRelations('renderNote'); const renderNoteIds = relations .map(rel => rel.value) .filter(noteId => noteId); diff --git a/src/public/javascripts/services/tree_builder.js b/src/public/javascripts/services/tree_builder.js index 2e4046c87..879577194 100644 --- a/src/public/javascripts/services/tree_builder.js +++ b/src/public/javascripts/services/tree_builder.js @@ -40,16 +40,16 @@ const NOTE_TYPE_ICONS = { "book": "bx bx-book" }; -async function getIconClass(note) { - const labels = await note.getLabels('iconClass'); +function getIconClass(note) { + const labels = note.getLabels('iconClass'); return labels.map(l => l.value).join(' '); } -async function getIcon(note) { +function getIcon(note) { const hoistedNoteId = hoistedNoteService.getHoistedNoteId(); - const iconClass = await getIconClass(note); + const iconClass = getIconClass(note); if (iconClass) { return iconClass; @@ -90,8 +90,8 @@ async function prepareNode(branch) { isProtected: note.isProtected, noteType: note.type, title: utils.escapeHtml(title), - extraClasses: await getExtraClasses(note), - icon: await getIcon(note), + extraClasses: getExtraClasses(note), + icon: getIcon(note), refKey: note.noteId, expanded: branch.isExpanded || hoistedNoteId === note.noteId, lazy: true, @@ -134,7 +134,7 @@ async function prepareSearchBranch(note) { return await prepareRealBranch(newNote); } -async function getExtraClasses(note) { +function getExtraClasses(note) { utils.assertArguments(note); const extraClasses = []; @@ -147,7 +147,7 @@ async function getExtraClasses(note) { extraClasses.push("multiple-parents"); } - const cssClass = await note.getCssClass(); + const cssClass = note.getCssClass(); if (cssClass) { extraClasses.push(cssClass); @@ -159,7 +159,7 @@ async function getExtraClasses(note) { extraClasses.push(utils.getMimeTypeClass(note.mime)); } - if (await note.hasLabel('archived')) { + if (note.hasLabel('archived')) { extraClasses.push("archived"); } diff --git a/src/public/javascripts/widgets/edited_notes.js b/src/public/javascripts/widgets/edited_notes.js index f3819e64d..39551cd36 100644 --- a/src/public/javascripts/widgets/edited_notes.js +++ b/src/public/javascripts/widgets/edited_notes.js @@ -20,7 +20,7 @@ export default class EditedNotesWidget extends CollapsibleWidget { async refreshWithNote(note) { // remember which title was when we found the similar notes this.title = note.title; - let editedNotes = await server.get('edited-notes/' + await note.getLabelValue("dateNote")); + let editedNotes = await server.get('edited-notes/' + note.getLabelValue("dateNote")); editedNotes = editedNotes.filter(n => n.noteId !== note.noteId); diff --git a/src/public/javascripts/widgets/note_detail.js b/src/public/javascripts/widgets/note_detail.js index 031970573..ccd4e9919 100644 --- a/src/public/javascripts/widgets/note_detail.js +++ b/src/public/javascripts/widgets/note_detail.js @@ -135,7 +135,7 @@ export default class NoteDetailWidget extends TabAwareWidget { const note = this.note; if (note) { - note.getCssClass().then(cssClass => this.$widget.addClass(cssClass)); + this.$widget.addClass(note.getCssClass()); this.$widget.addClass(utils.getNoteTypeClass(note.type)); this.$widget.addClass(utils.getMimeTypeClass(note.mime)); diff --git a/src/public/javascripts/widgets/note_tree.js b/src/public/javascripts/widgets/note_tree.js index 69a7ca581..a7578dcec 100644 --- a/src/public/javascripts/widgets/note_tree.js +++ b/src/public/javascripts/widgets/note_tree.js @@ -343,7 +343,7 @@ export default class NoteTreeWidget extends TabAwareWidget { await parentNode.setExpanded(true, expandOpts); } - await this.updateNode(parentNode); + this.updateNode(parentNode); let foundChildNode = this.findChildNode(parentNode, childNoteId); @@ -384,15 +384,15 @@ export default class NoteTreeWidget extends TabAwareWidget { return this.getNodeFromPath(notePath, true, expandOpts); } - async updateNode(node) { + updateNode(node) { const note = treeCache.getNoteFromCache(node.data.noteId); const branch = treeCache.getBranch(node.data.branchId); node.data.isProtected = note.isProtected; node.data.noteType = note.type; node.folder = note.type === 'search' || note.getChildNoteIds().length > 0; - node.icon = await treeBuilder.getIcon(note); - node.extraClasses = await treeBuilder.getExtraClasses(note); + node.icon = treeBuilder.getIcon(note); + node.extraClasses = treeBuilder.getExtraClasses(note); node.title = (branch.prefix ? (branch.prefix + " - ") : "") + note.title; node.renderTitle(); } @@ -526,13 +526,13 @@ export default class NoteTreeWidget extends TabAwareWidget { for (const node of this.getNodesByNoteId(noteId)) { await node.load(true); - await this.updateNode(node); + this.updateNode(node); } } for (const noteId of noteIdsToUpdate) { for (const node of this.getNodesByNoteId(noteId)) { - await this.updateNode(node); + this.updateNode(node); } } diff --git a/src/public/javascripts/widgets/promoted_attributes.js b/src/public/javascripts/widgets/promoted_attributes.js index 7c92709a4..56d6404da 100644 --- a/src/public/javascripts/widgets/promoted_attributes.js +++ b/src/public/javascripts/widgets/promoted_attributes.js @@ -38,7 +38,7 @@ export default class PromotedAttributesWidget extends TabAwareWidget { async refreshWithNote(note) { this.$container.empty(); - const attributes = await note.getAttributes(); + const attributes = note.getAttributes(); const promoted = attributes.filter(attr => (attr.type === 'label-definition' || attr.type === 'relation-definition') diff --git a/src/public/javascripts/widgets/tab_row.js b/src/public/javascripts/widgets/tab_row.js index fd1db5c75..325f9b11b 100644 --- a/src/public/javascripts/widgets/tab_row.js +++ b/src/public/javascripts/widgets/tab_row.js @@ -612,7 +612,7 @@ export default class TabRowWidget extends BasicWidget { } } - note.getCssClass().then(cssClass => $tab.addClass(cssClass)); + $tab.addClass(note.getCssClass()); $tab.addClass(utils.getNoteTypeClass(note.type)); $tab.addClass(utils.getMimeTypeClass(note.mime)); } diff --git a/src/public/javascripts/widgets/type_widgets/book.js b/src/public/javascripts/widgets/type_widgets/book.js index d06925e60..13ba4a55b 100644 --- a/src/public/javascripts/widgets/type_widgets/book.js +++ b/src/public/javascripts/widgets/type_widgets/book.js @@ -145,7 +145,7 @@ export default class BookTypeWidget extends TypeWidget { .append(' if you want to add some text.')); } - const zoomLevel = parseInt(await note.getLabelValue('bookZoomLevel')) || this.getDefaultZoomLevel(); + const zoomLevel = parseInt(note.getLabelValue('bookZoomLevel')) || this.getDefaultZoomLevel(); this.setZoom(zoomLevel); await this.renderIntoElement(note, this.$content); diff --git a/src/public/javascripts/widgets/type_widgets/file.js b/src/public/javascripts/widgets/type_widgets/file.js index 1facde24a..ad723ee21 100644 --- a/src/public/javascripts/widgets/type_widgets/file.js +++ b/src/public/javascripts/widgets/type_widgets/file.js @@ -99,7 +99,7 @@ export default class FileTypeWidget extends TypeWidget { } async doRefresh(note) { - const attributes = await note.getAttributes(); + const attributes = note.getAttributes(); const attributeMap = utils.toObject(attributes, l => [l.name, l.value]); this.$widget.show(); diff --git a/src/public/javascripts/widgets/type_widgets/image.js b/src/public/javascripts/widgets/type_widgets/image.js index d6c7c31d2..4e993ca7c 100644 --- a/src/public/javascripts/widgets/type_widgets/image.js +++ b/src/public/javascripts/widgets/type_widgets/image.js @@ -112,7 +112,7 @@ class ImageTypeWidget extends TypeWidget { } async doRefresh(note) { - const attributes = await note.getAttributes(); + const attributes = note.getAttributes(); const attributeMap = utils.toObject(attributes, l => [l.name, l.value]); this.$widget.show(); diff --git a/src/public/javascripts/widgets/type_widgets/text.js b/src/public/javascripts/widgets/type_widgets/text.js index 101af8cee..2362761e1 100644 --- a/src/public/javascripts/widgets/type_widgets/text.js +++ b/src/public/javascripts/widgets/type_widgets/text.js @@ -141,7 +141,7 @@ export default class TextTypeWidget extends TypeWidget { } async doRefresh(note) { - this.textEditor.isReadOnly = await note.hasLabel('readOnly'); + this.textEditor.isReadOnly = note.hasLabel('readOnly'); const noteComplement = await treeCache.getNoteComplement(note.noteId);