mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 11:56:01 +01:00
sidebar & widget state management WIP
This commit is contained in:
@@ -31,11 +31,19 @@ class NoteInfoWidget {
|
||||
constructor(ctx, $widget) {
|
||||
this.ctx = ctx;
|
||||
this.$widget = $widget;
|
||||
this.$widget.on('show.bs.collapse', () => this.renderBody());
|
||||
this.$widget.on('show.bs.collapse', () => this.ctx.stateChanged());
|
||||
this.$widget.on('hide.bs.collapse', () => this.ctx.stateChanged());
|
||||
this.$title = this.$widget.find('.widget-title');
|
||||
this.$title.text("Note info");
|
||||
this.$bodyWrapper = this.$widget.find('.body-wrapper');
|
||||
}
|
||||
|
||||
async renderBody() {
|
||||
if (!this.isVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const $body = this.$widget.find('.card-body');
|
||||
|
||||
$body.html(TPL);
|
||||
@@ -60,6 +68,17 @@ class NoteInfoWidget {
|
||||
this.renderBody();
|
||||
}
|
||||
}
|
||||
|
||||
getWidgetState() {
|
||||
return {
|
||||
id: 'attributes',
|
||||
visible: this.isVisible()
|
||||
};
|
||||
}
|
||||
|
||||
isVisible() {
|
||||
return this.$bodyWrapper.is(":visible");
|
||||
}
|
||||
}
|
||||
|
||||
export default NoteInfoWidget;
|
||||
Reference in New Issue
Block a user