Skip to content

Commit 28ce406

Browse files
chore: Update all embed frames (codesandbox#3888)
1 parent 7618494 commit 28ce406

File tree

8 files changed

+27
-25
lines changed

8 files changed

+27
-25
lines changed

packages/app/src/app/pages/common/Modals/ShareModal/getCode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ export const getIframeScript = (sandbox, mainModule, state) =>
7272
src="${getEmbedUrl(sandbox, mainModule, state)}"
7373
style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;"
7474
title="${escapeHtml(getSandboxName(sandbox))}"
75-
allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"
76-
sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
75+
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr"
76+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
7777
></iframe>`;
7878

7979
// eslint-disable-next-line

packages/common/src/components/Preview/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,8 +595,8 @@ class BasePreview extends React.Component<Props, State> {
595595
{(style: { opacity: number }) => (
596596
<>
597597
<StyledFrame
598-
sandbox="allow-forms allow-scripts allow-same-origin allow-modals allow-popups allow-presentation"
599-
allow="geolocation; microphone; camera;midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb; hid"
598+
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr"
599+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
600600
src={this.state.url}
601601
ref={this.setIframeElement}
602602
title={getSandboxName(sandbox)}

packages/homepage/content/docs/2-embedding.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ description: Embed a sandbox in docs, blog posts, Medium, and other websites.
66

77
## What is an Embed?
88

9-
An embed enables you to include a sandbox in your documentation, blog post,
10-
or website using an iframe, or anywhere with Embedly support, like Medium,
11-
Reddit, Trello, and Notion. You can show just the code, the preview, or both
12-
at the same time.
9+
An embed enables you to include a sandbox in your documentation, blog post, or
10+
website using an iframe, or anywhere with Embedly support, like Medium, Reddit,
11+
Trello, and Notion. You can show just the code, the preview, or both at the same
12+
time.
1313

1414
CodeSandbox has a separate application for the embed. This application is
1515
specifically built to be as small as possible. If you replace `s` in the URL of
@@ -19,8 +19,8 @@ the embed doesn't have all of the features of the full editor.
1919

2020
## Generate an Embed URL
2121

22-
You can generate a URL to embed by clicking 'Embed' in the header on the editor and selecting the options
23-
you want to have enabled.
22+
You can generate a URL to embed by clicking 'Embed' in the header on the editor
23+
and selecting the options you want to have enabled.
2424

2525
![Share Button](./images/share-button.png)
2626

@@ -72,14 +72,14 @@ Use this code to embed:
7272
<iframe
7373
src="https://codesandbox.io/embed/new?codemirror=1"
7474
style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;"
75-
allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"
76-
sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
75+
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr"
76+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
7777
></iframe>
7878
```
7979

8080
That will give to a result like this:
8181

82-
<iframe src="https://codesandbox.io/embed/new?codemirror=1" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>
82+
<iframe src="https://codesandbox.io/embed/new?codemirror=1" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"></iframe>
8383

8484
### Code Example Embed
8585

@@ -94,11 +94,11 @@ Use this code to embed:
9494
<iframe
9595
src="https://codesandbox.io/embed/new?codemirror=1&highlights=6,7,8,9"
9696
style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;"
97-
allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"
98-
sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
97+
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr"
98+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
9999
></iframe>
100100
```
101101

102102
That will give to a result like this:
103103

104-
<iframe src="https://codesandbox.io/embed/new?codemirror=1&highlights=6,7,8,9" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>
104+
<iframe src="https://codesandbox.io/embed/new?codemirror=1&highlights=6,7,8,9" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"></iframe>

packages/homepage/content/docs/2-importing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ const url = `https://codesandbox.io/api/v1/sandboxes/define?parameters=${paramet
142142

143143
#### Example Sandbox
144144

145-
<iframe src="https://codesandbox.io/embed/6yznjvl7nw?editorsize=50&fontsize=14&hidenavigation=1&runonclick=1" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>
145+
<iframe src="https://codesandbox.io/embed/6yznjvl7nw?editorsize=50&fontsize=14&hidenavigation=1&runonclick=1" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"></iframe>
146146

147147
### POST Form
148148

@@ -151,7 +151,7 @@ show a form. With a POST request you can create bigger sandboxes.
151151

152152
#### Example Sandbox
153153

154-
<iframe src="https://codesandbox.io/embed/qzlp7nw34q?editorsize=70&fontsize=14&hidenavigation=1&runonclick=1" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>
154+
<iframe src="https://codesandbox.io/embed/qzlp7nw34q?editorsize=70&fontsize=14&hidenavigation=1&runonclick=1" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"></iframe>
155155

156156
### Define without render
157157

@@ -172,7 +172,7 @@ Both `get` and `post` requests are supported.
172172
You can also create a sandbox using an XHR request, like using `fetch`. An
173173
example sandbox of that is here:
174174

175-
<iframe src="https://codesandbox.io/embed/9loovqj5oy?editorsize=70&fontsize=14&hidenavigation=1&runonclick=1" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>
175+
<iframe src="https://codesandbox.io/embed/9loovqj5oy?editorsize=70&fontsize=14&hidenavigation=1&runonclick=1" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"></iframe>
176176

177177
## Import Single Components
178178

packages/homepage/content/docs/2-tests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ And will also show squiggles in the editor:
4646

4747
Here's a failing Jest test running in a sandbox:
4848

49-
<iframe src="https://codesandbox.io/embed/n9m2w9q8x0?view=preview" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>
49+
<iframe src="https://codesandbox.io/embed/n9m2w9q8x0?view=preview" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"></iframe>

packages/homepage/content/docs/5-secrets.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ secret like this, it justs illustrates how to access them).
4040
src="https://codesandbox.io/embed/broken-resonance-35lyl?codemirror=1&fontsize=14&hidenavigation=1&theme=dark"
4141
style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;"
4242
title="broken-resonance-35lyl"
43-
allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"
44-
sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
45-
></iframe>
43+
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr"
44+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
45+
></iframe>
4646
4747
## Editing secrets
4848

packages/homepage/src/screens/home/explore/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ const Sandbox = ({
9696
big={big}
9797
title={id}
9898
src={`https://codesandbox.io/embed/${id}?fontsize=14&hidenavigation=1&view=preview&hidedevtools=1`}
99-
sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
99+
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr"
100+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
100101
/>
101102
) : (
102103
<Button href={`https://codesandbox.io/s/${id}`} target="_blank">

standalone-packages/react-sandpack/src/components/SandpackProvider/SandpackProvider.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ export default class SandpackProvider extends React.PureComponent<
273273
position: 'absolute',
274274
visibility: 'hidden',
275275
}}
276-
sandbox="allow-forms allow-scripts allow-same-origin allow-modals allow-popups allow-presentation"
276+
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr"
277+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
277278
src={this.props.bundlerURL}
278279
/>
279280
{children}

0 commit comments

Comments
 (0)