1
0

Improved cached widget height

This commit is contained in:
Zef Hemel 2023-10-03 14:34:07 +02:00
parent 0313565610
commit 3535bc9449

View File

@ -52,13 +52,15 @@ class IFrameWidget extends WidgetType {
}, },
); );
iframe.style.height = `${this.estimatedHeight}px`;
return iframe; return iframe;
} }
get estimatedHeight(): number { get estimatedHeight(): number {
const cachedHeight = this.editor.space.getCachedWidgetHeight(this.bodyText); const cachedHeight = this.editor.space.getCachedWidgetHeight(this.bodyText);
// console.log("Calling estimated height", cachedHeight); console.log("Calling estimated height", cachedHeight);
return cachedHeight || 150; return cachedHeight > 0 ? cachedHeight : 150;
} }
eq(other: WidgetType): boolean { eq(other: WidgetType): boolean {