Browse Source

fix: set codesandbox referrer to no-referrer (#22792)

pull/22797/head
Rustin 5 years ago
committed by GitHub
parent
commit
44d74415bc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      site/theme/static/demo.less
  2. 24
      site/theme/template/Content/Demo.jsx

1
site/theme/static/demo.less

@ -256,6 +256,7 @@
}
&-codesandbox {
display: inline-block;
width: 20px;
height: 20px;
overflow: hidden;

24
site/theme/template/Content/Demo.jsx

@ -270,22 +270,18 @@ ${sourceCode.replace('mountNode', "document.getElementById('container')")}
/>
</Tooltip>
</form>
<form
action="https://codesandbox.io/api/v1/sandboxes/define"
method="POST"
target="_blank"
onClick={() => this.track({ type: 'codesandbox', demo: meta.id })}
>
<input
type="hidden"
name="parameters"
value={compress(JSON.stringify(codesanboxPrefillConfig))}
/>
<form>
<Tooltip title={<FormattedMessage id="app.demo.codesandbox" />}>
<input
type="submit"
value="Create New Sandbox with Prefilled Data"
{/* FIXME: This temporarily solution to fix issues/22636, we need revert it to use form after the codesandbox api issue fixed. */}
<a
aria-label="Create New Sandbox with Prefilled Data"
rel="noopener noreferrer"
target="_blank"
href={`https://codesandbox.io/api/v1/sandboxes/define?parameters=${compress(
JSON.stringify(codesanboxPrefillConfig),
)}`}
className="code-box-codesandbox"
onClick={() => this.track({ type: 'codesandbox', demo: meta.id })}
/>
</Tooltip>
</form>

Loading…
Cancel
Save