Skip to content

Commit 8115052

Browse files
fix iframe width styling
1 parent 98abd25 commit 8115052

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

  • packages/builder-web-core/widgets-native/html-iframe

packages/builder-web-core/widgets-native/html-iframe/index.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,26 @@ export class HtmlIframe extends Container implements IIframeProps {
139139
attributes: attrs,
140140
};
141141
}
142+
143+
get finalStyle() {
144+
const superstyl = super.finalStyle;
145+
146+
// width override. ------------------------------------------------------------------------------------------
147+
// iframe element's width needs to be specified if the position is absolute and the left & right is specified.
148+
let width = superstyl.width;
149+
if (
150+
width === undefined &&
151+
superstyl.position === "absolute" &&
152+
superstyl.left !== undefined &&
153+
superstyl.right !== undefined
154+
) {
155+
width = "calc(100% - " + superstyl.left + " - " + superstyl.right + ")";
156+
}
157+
// ----------------------------------------------------------------------------------------------------------
158+
159+
return {
160+
...superstyl,
161+
width,
162+
};
163+
}
142164
}

0 commit comments

Comments
 (0)