mirror of
https://github.com/zadam/trilium.git
synced 2025-12-22 15:24:24 +01:00
feat(client/bundle): make Preact custom widgets content-sized by default
This commit is contained in:
parent
76f054bbd5
commit
1093acfe45
@ -1,7 +1,7 @@
|
|||||||
import { h, VNode } from "preact";
|
import { h, VNode } from "preact";
|
||||||
|
|
||||||
import Component from "../components/component.js";
|
import Component from "../components/component.js";
|
||||||
import BasicWidget from "../widgets/basic_widget.js";
|
import BasicWidget, { ReactWrappedWidget } from "../widgets/basic_widget.js";
|
||||||
import RightPanelWidget from "../widgets/right_panel_widget.js";
|
import RightPanelWidget from "../widgets/right_panel_widget.js";
|
||||||
import froca from "./froca.js";
|
import froca from "./froca.js";
|
||||||
import type { Entity } from "./frontend_script_api.js";
|
import type { Entity } from "./frontend_script_api.js";
|
||||||
@ -106,8 +106,10 @@ export class WidgetsByParent {
|
|||||||
const widgets: (Component | VNode)[] = this.getLegacyWidgets(parentName);
|
const widgets: (Component | VNode)[] = this.getLegacyWidgets(parentName);
|
||||||
for (const preactWidget of this.getPreactWidgets(parentName)) {
|
for (const preactWidget of this.getPreactWidgets(parentName)) {
|
||||||
const el = h(preactWidget.render, {});
|
const el = h(preactWidget.render, {});
|
||||||
|
const widget = new ReactWrappedWidget(el);
|
||||||
|
widget.contentSized();
|
||||||
// TODO: set position here.
|
// TODO: set position here.
|
||||||
widgets.push(el);
|
widgets.push(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
return widgets;
|
return widgets;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user