Skip to content

Commit 7e37592

Browse files
iframe: add allow attr, fix width / height sizing
1 parent 8115052 commit 7e37592

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

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

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

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export interface IIframeProps {
3838

3939
readonly src?: string;
4040
readonly srcdoc?: string;
41-
readonly width: DimensionLength;
42-
readonly height: DimensionLength;
41+
readonly fwidth: DimensionLength;
42+
readonly fheight: DimensionLength;
4343

4444
readonly allow?: string;
4545
readonly loading?: "eager" | "lazy";
@@ -54,8 +54,8 @@ export class HtmlIframe extends Container implements IIframeProps {
5454

5555
readonly src?: string;
5656
readonly srcdoc?: string;
57-
readonly width: DimensionLength;
58-
readonly height: DimensionLength;
57+
readonly fwidth: DimensionLength;
58+
readonly fheight: DimensionLength;
5959

6060
readonly allow?: string;
6161
readonly loading?: "eager" | "lazy";
@@ -69,8 +69,8 @@ export class HtmlIframe extends Container implements IIframeProps {
6969
title,
7070
src,
7171
srcdoc,
72-
width,
73-
height,
72+
fwidth: width,
73+
fheight: height,
7474
allow,
7575
loading,
7676
name,
@@ -84,8 +84,8 @@ export class HtmlIframe extends Container implements IIframeProps {
8484
this.title = title;
8585
this.src = src;
8686
this.srcdoc = srcdoc;
87-
this.width = width;
88-
this.height = height;
87+
this.fwidth = width;
88+
this.fheight = height;
8989
this.allow = allow;
9090
this.loading = loading;
9191
this.name = name;
@@ -104,6 +104,7 @@ export class HtmlIframe extends Container implements IIframeProps {
104104

105105
/* Override default CSS styles */
106106
border: containerstyle.border ?? "none",
107+
overflow: containerstyle.overflow ?? "hidden",
107108
/* --------------------------- */
108109

109110
// ----------------------
@@ -117,10 +118,10 @@ export class HtmlIframe extends Container implements IIframeProps {
117118
this.src && new JSXAttribute("src", new StringLiteral(this.src)),
118119
this.srcdoc && new JSXAttribute("srcdoc", new StringLiteral(this.srcdoc)),
119120

120-
this.width &&
121-
new JSXAttribute("width", new StringLiteral(css.length(this.width))),
122-
this.height &&
123-
new JSXAttribute("height", new StringLiteral(css.length(this.height))),
121+
this.fwidth &&
122+
new JSXAttribute("width", new StringLiteral(css.length(this.fwidth))),
123+
this.fheight &&
124+
new JSXAttribute("height", new StringLiteral(css.length(this.fheight))),
124125

125126
this.sandbox?.length > 0 &&
126127
new JSXAttribute(
@@ -131,6 +132,8 @@ export class HtmlIframe extends Container implements IIframeProps {
131132
: (this.sandbox as string)
132133
)
133134
),
135+
136+
this.allow && new JSXAttribute("allow", new StringLiteral(this.allow)),
134137
].filter(Boolean);
135138

136139
return <StylableJSXElementConfig>{

0 commit comments

Comments
 (0)