Skip to content

Commit 73ca77a

Browse files
committed
Fix propTypes for EmbedFrame, add sandbox/allow to PreviewFrame
1 parent c397fd4 commit 73ca77a

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

client/modules/IDE/components/PreviewFrame.jsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,20 @@ function PreviewFrame({ fullView }) {
2222
});
2323

2424
const frameUrl = previewUrl;
25-
const sandboxAttributes =
26-
'allow-scripts allow-pointer-lock allow-popups allow-forms allow-modals allow-downloads allow-same-origin';
25+
const sandboxAttributes = `allow-downloads allow-forms allow-modals allow-pointer-lock allow-popups
26+
allow-presentation allow-same-origin allow-scripts allow-top-navigation-by-user-activation`;
27+
const allow =
28+
'accelerometer; autoplay; camera; encrypted-media; geolocation; gyroscope; microphone; magnetometer; midi; vr;';
2729
return (
2830
<Frame
2931
title="sketch preview"
3032
src={frameUrl}
3133
sandbox={sandboxAttributes}
34+
allow={allow}
35+
scrolling="auto"
36+
allowtransparency
37+
allowpaymentrequest
38+
allowFullScreen
3239
frameBorder="0"
3340
ref={iframe}
3441
fullView={fullView}

client/modules/Preview/EmbedFrame.jsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -256,25 +256,24 @@ function EmbedFrame({ files, isPlaying, basePath }) {
256256
}
257257

258258
useEffect(renderSketch, [files, isPlaying]);
259-
const sandboxAttributes =
260-
'allow-scripts allow-pointer-lock allow-popups allow-forms allow-modals allow-downloads allow-same-origin';
261259
return (
262260
<Frame
263261
aria-label="Sketch Preview"
264262
role="main"
265263
frameBorder="0"
266264
ref={iframe}
267-
sandbox={sandboxAttributes}
268265
/>
269266
);
270267
}
271268

272269
EmbedFrame.propTypes = {
273-
files: PropTypes.arrayOf({
274-
id: PropTypes.string.isRequired,
275-
name: PropTypes.string.isRequired,
276-
content: PropTypes.string.isRequired
277-
}).isRequired,
270+
files: PropTypes.arrayOf(
271+
PropTypes.shape({
272+
id: PropTypes.string.isRequired,
273+
name: PropTypes.string.isRequired,
274+
content: PropTypes.string.isRequired
275+
})
276+
).isRequired,
278277
isPlaying: PropTypes.bool.isRequired,
279278
basePath: PropTypes.string.isRequired
280279
};

0 commit comments

Comments
 (0)