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() {
|
async noteLoaded() {
|
||||||
this.$widgets.empty();
|
this.$widgets.empty();
|
||||||
|
|
||||||
this.addAttributesWidget();
|
const widgetClasses = [AttributesWidget, LinkMapWidget, NoteRevisionsWidget, NoteInfoWidget];
|
||||||
this.addNoteInfoWidget();
|
|
||||||
this.addLinkMapWidget();
|
|
||||||
this.addNoteRevisionsWidget();
|
|
||||||
}
|
|
||||||
|
|
||||||
async addAttributesWidget() {
|
for (const widgetClass of widgetClasses) {
|
||||||
const $widget = this.createWidgetElement();
|
const $widget = this.createWidgetElement();
|
||||||
|
|
||||||
const attributesWidget = new AttributesWidget(this.ctx, $widget);
|
const attributesWidget = new widgetClass(this.ctx, $widget);
|
||||||
await attributesWidget.renderBody();
|
attributesWidget.renderBody(); // let it run in parallel
|
||||||
|
|
||||||
this.$widgets.append($widget);
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createWidgetElement() {
|
createWidgetElement() {
|
||||||
|
@ -118,6 +118,7 @@ ul.fancytree-container {
|
|||||||
|
|
||||||
.note-detail-sidebar {
|
.note-detail-sidebar {
|
||||||
min-width: 350px;
|
min-width: 350px;
|
||||||
|
max-width: 350px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
padding-top: 12px;
|
padding-top: 12px;
|
||||||
padding-left: 7px;
|
padding-left: 7px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user