mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
instantiate widgets dynamically
This commit is contained in:
parent
7bee93bb73
commit
fcd87b3e2d
@ -48,46 +48,16 @@ class Sidebar {
|
||||
async noteLoaded() {
|
||||
this.$widgets.empty();
|
||||
|
||||
this.addAttributesWidget();
|
||||
this.addNoteInfoWidget();
|
||||
this.addLinkMapWidget();
|
||||
this.addNoteRevisionsWidget();
|
||||
}
|
||||
const widgetClasses = [AttributesWidget, LinkMapWidget, NoteRevisionsWidget, NoteInfoWidget];
|
||||
|
||||
async addAttributesWidget() {
|
||||
const $widget = this.createWidgetElement();
|
||||
for (const widgetClass of widgetClasses) {
|
||||
const $widget = this.createWidgetElement();
|
||||
|
||||
const attributesWidget = new AttributesWidget(this.ctx, $widget);
|
||||
await attributesWidget.renderBody();
|
||||
const attributesWidget = new widgetClass(this.ctx, $widget);
|
||||
attributesWidget.renderBody(); // let it run in parallel
|
||||
|
||||
this.$widgets.append($widget);
|
||||
}
|
||||
|
||||
async addNoteInfoWidget() {
|
||||
const $widget = this.createWidgetElement();
|
||||
|
||||
const noteInfoWidget = new NoteInfoWidget(this.ctx, $widget);
|
||||
await noteInfoWidget.renderBody();
|
||||
|
||||
this.$widgets.append($widget);
|
||||
}
|
||||
|
||||
async addLinkMapWidget() {
|
||||
const $widget = this.createWidgetElement();
|
||||
|
||||
const linkMapWidget = new LinkMapWidget(this.ctx, $widget);
|
||||
await linkMapWidget.renderBody();
|
||||
|
||||
this.$widgets.append($widget);
|
||||
}
|
||||
|
||||
async addNoteRevisionsWidget() {
|
||||
const $widget = this.createWidgetElement();
|
||||
|
||||
const noteRevisionsWidget = new NoteRevisionsWidget(this.ctx, $widget);
|
||||
await noteRevisionsWidget.renderBody();
|
||||
|
||||
this.$widgets.append($widget);
|
||||
this.$widgets.append($widget);
|
||||
}
|
||||
}
|
||||
|
||||
createWidgetElement() {
|
||||
|
@ -118,6 +118,7 @@ ul.fancytree-container {
|
||||
|
||||
.note-detail-sidebar {
|
||||
min-width: 350px;
|
||||
max-width: 350px;
|
||||
overflow: auto;
|
||||
padding-top: 12px;
|
||||
padding-left: 7px;
|
||||
|
Loading…
x
Reference in New Issue
Block a user