From 3a78a75afcf5fe6c31a8e31aed12af2227a1b161 Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 26 Jul 2021 21:11:51 +0200 Subject: [PATCH] fixed frontend update after note deletion --- src/public/app/entities/attribute.js | 2 ++ src/public/app/entities/branch.js | 2 ++ src/public/app/entities/note_short.js | 2 ++ src/public/app/widgets/note_tree.js | 5 +++++ src/public/stylesheets/tree.css | 9 +++++---- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/public/app/entities/attribute.js b/src/public/app/entities/attribute.js index e1e34cbfb..e465062b3 100644 --- a/src/public/app/entities/attribute.js +++ b/src/public/app/entities/attribute.js @@ -22,6 +22,8 @@ class Attribute { this.position = row.position; /** @param {boolean} isInheritable */ this.isInheritable = !!row.isInheritable; + /** @param {boolean} */ + this.isDeleted = !!row.isDeleted; } /** @returns {NoteShort} */ diff --git a/src/public/app/entities/branch.js b/src/public/app/entities/branch.js index 27802623e..1b346c626 100644 --- a/src/public/app/entities/branch.js +++ b/src/public/app/entities/branch.js @@ -21,6 +21,8 @@ class Branch { this.isExpanded = !!row.isExpanded; /** @param {boolean} */ this.fromSearchNote = !!row.fromSearchNote; + /** @param {boolean} */ + this.isDeleted = !!row.isDeleted; } /** @returns {NoteShort} */ diff --git a/src/public/app/entities/note_short.js b/src/public/app/entities/note_short.js index 39c0c712e..0ca35b34c 100644 --- a/src/public/app/entities/note_short.js +++ b/src/public/app/entities/note_short.js @@ -61,6 +61,8 @@ class NoteShort { this.type = row.type; /** @param {string} content-type, e.g. "application/json" */ this.mime = row.mime; + /** @param {boolean} */ + this.isDeleted = !!row.isDeleted; } addParent(parentNoteId, branchId) { diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js index 7e32863b8..a36fa4158 100644 --- a/src/public/app/widgets/note_tree.js +++ b/src/public/app/widgets/note_tree.js @@ -455,6 +455,11 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { } const note = await froca.getNote(node.data.noteId); + + if (!note || note.isDeleted) { + return; + } + const activeNoteContext = appContext.tabManager.getActiveContext(); const $span = $(node.span); diff --git a/src/public/stylesheets/tree.css b/src/public/stylesheets/tree.css index 3c3b9849d..a8beb9302 100644 --- a/src/public/stylesheets/tree.css +++ b/src/public/stylesheets/tree.css @@ -11,7 +11,8 @@ span.fancytree-node.fancytree-hide { } .fancytree-title { - margin-left: 7px !important; + margin-left: 7px; + outline: none; } .fancytree-expander { @@ -54,7 +55,7 @@ span.fancytree-node.fancytree-hide { } .fancytree-loading span.fancytree-expander { - background-image: none !important; + background-image: none; display: inline-block; width: 16px; height: 16px; @@ -119,8 +120,8 @@ span.fancytree-node.muted { opacity: 0.6; } } ul.fancytree-container { - outline: none !important; - background-color: inherit !important; + outline: none; + background-color: inherit; } .fancytree-custom-icon {