Skip to content

Commit c0def07

Browse files
committed
Update srcdoc-polyfill, fix rendering on Safari
1 parent 672f23e commit c0def07

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

client/modules/IDE/components/PreviewFrame.jsx

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

2424
const frameUrl = previewUrl;
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`;
25+
const sandboxAttributes = `allow-forms allow-modals allow-pointer-lock allow-popups
26+
allow-same-origin allow-scripts allow-top-navigation-by-user-activation`;
2727
const allow =
2828
'accelerometer; autoplay; camera; encrypted-media; geolocation; gyroscope; microphone; magnetometer; midi; vr;';
2929
return (

client/modules/Preview/EmbedFrame.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ function resolveScripts(sketchDoc, files) {
149149
script.getAttribute('src').match(EXTERNAL_LINK_REGEX)
150150
) !== null
151151
) {
152-
script.setAttribute('crossorigin', '');
152+
// script.setAttribute('crossorigin', '');
153153
script.innerHTML = resolveJSLinksInString(script.innerHTML, files); // eslint-disable-line
154154
}
155155
});
@@ -266,7 +266,10 @@ function EmbedFrame({ files, isPlaying, basePath }) {
266266
const doc = iframe.current;
267267
if (isPlaying) {
268268
const htmlDoc = injectLocalFiles(files, htmlFile, basePath);
269-
srcDoc.set(doc, htmlDoc);
269+
// BRO FOR SOME REASON YOU HAVE TO DO THIS TO GET IT TO WORK ON SAFARI
270+
setTimeout(() => {
271+
srcDoc.set(doc, htmlDoc);
272+
}, 0);
270273
} else {
271274
doc.srcdoc = '';
272275
srcDoc.set(doc, ' ');

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@
228228
"sinon": "^7.5.0",
229229
"sinon-mongoose": "^2.3.0",
230230
"slugify": "^1.3.6",
231-
"srcdoc-polyfill": "^0.2.0",
231+
"srcdoc-polyfill": "^1.0.0",
232232
"styled-components": "^5.0.0",
233233
"styled-theming": "^2.2.0",
234234
"url": "^0.11.0",

0 commit comments

Comments
 (0)