Skip to content

Build your personal knowledge base with Trilium Notes

fix collapsing/expanding the book note

zadamd975acc99a2c
diff --git a/src/public/app/widgets/buttons/note_actions.js b/src/public/app/widgets/buttons/note_actions.js
index 2f0c5b4521..ddfc429e0b 100644
--- a/src/public/app/widgets/buttons/note_actions.js
+++ b/src/public/app/widgets/buttons/note_actions.js
@@ -53,8 +53,7 @@ export default class NoteActionsWidget extends NoteContextAwareWidget {
this.$importNoteButton = this.$widget.find('.import-files-button');
this.$importNoteButton.on("click", () => import('../../dialogs/import.js').then(d => d.showDialog(this.noteId)));
- this.$widget.on('click', '.dropdown-item',
- () => this.$widget.find('.dropdown-toggle').dropdown('toggle'));
+ this.$widget.on('click', '.dropdown-item', () => this.$widget.find('.dropdown-menu').dropdown('toggle'));
this.$openNoteExternallyButton = this.$widget.find(".open-note-externally-button");
}
diff --git a/src/public/app/widgets/buttons/protected_session_status.js b/src/public/app/widgets/buttons/protected_session_status.js
index 7037b03e68..18f9aa8192 100644
--- a/src/public/app/widgets/buttons/protected_session_status.js
+++ b/src/public/app/widgets/buttons/protected_session_status.js
@@ -10,8 +10,8 @@ export default class ProtectedSessionStatusWidget extends ButtonWidget {
updateSettings() {
this.settings.icon = protectedSessionHolder.isProtectedSessionAvailable()
- ? "bx-shield-quarter"
- : "bx-log-in";
+ ? "bx-check-shield"
+ : "bx-shield-quarter";
this.settings.title = protectedSessionHolder.isProtectedSessionAvailable()
? "Protected session is active. Click to leave protected session."
diff --git a/src/public/app/widgets/note_list.js b/src/public/app/widgets/note_list.js
index 1584dc8e4c..785786e920 100644
--- a/src/public/app/widgets/note_list.js
+++ b/src/public/app/widgets/note_list.js
@@ -66,12 +66,17 @@ export default class NoteListWidget extends NoteContextAwareWidget {
}
async refresh() {
- this.$content.empty();
this.shownNoteId = null;
await super.refresh();
}
+ async refreshNoteListEvent({noteId}) {
+ if (this.isNote(noteId)) {
+ await this.renderNoteList(this.note);
+ }
+ }
+
/**
* We have this event so that we evaluate intersection only after note detail is loaded.
* If it's evaluated before note detail then it's clearly intersected (visible) although after note detail load
@@ -94,7 +99,7 @@ export default class NoteListWidget extends NoteContextAwareWidget {
}
entitiesReloadedEvent({loadResults}) {
- if (loadResults.getAttributes().find(attr => attr.noteId === this.noteId && attr.name === 'viewType')) {
+ if (loadResults.getAttributes().find(attr => attr.noteId === this.noteId && ['viewType', 'expanded'].includes(attr.name))) {
this.shownNoteId = null; // force render
this.checkRenderStatus();
diff --git a/src/public/app/widgets/ribbon_widgets/book_properties.js b/src/public/app/widgets/ribbon_widgets/book_properties.js
index 01a69f20b6..7aff9a5aa7 100644
--- a/src/public/app/widgets/ribbon_widgets/book_properties.js
+++ b/src/public/app/widgets/ribbon_widgets/book_properties.js
@@ -75,6 +75,8 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget {
if (!this.note.hasLabel('expanded')) {
await attributeService.addLabel(this.noteId, 'expanded');
}
+
+ this.triggerCommand('refreshNoteList', {noteId: this.noteId});
});
this.$collapseAllButton = this.$widget.find('.collapse-all-button');
@@ -83,6 +85,8 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget {
for (const expandedAttr of this.note.getOwnedLabels('expanded')) {
await attributeService.removeAttributeById(this.noteId, expandedAttr.attributeId);
}
+
+ this.triggerCommand('refreshNoteList', {noteId: this.noteId});
});
}