mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix collapsing/expanding the book note
This commit is contained in:
parent
c2d35dac4d
commit
d975acc99a
@ -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");
|
||||
}
|
||||
|
@ -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."
|
||||
|
@ -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();
|
||||
|
@ -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});
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user