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

* fix: set referrer to no-referrer

* fix: use <a> replace form

* refactoring: remove useless code

* fix: refine css issue
This commit is contained in:
Rustin 2020-03-28 15:16:39 +08:00 committed by GitHub
parent 7b94e0bfb2
commit c806a836e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 17 deletions

View File

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

View File

@ -22,7 +22,7 @@
<link rel="stylesheet/less" type="text/css" href="{{ root }}color.less" />
<script src="https://polyfill.alicdn.com/polyfill.min.js?features=default,es2015,Intl"></script>
<script>
(function() {
(function () {
function isLocalStorageNameSupported() {
var testKey = 'test';
var storage = window.localStorage;
@ -100,10 +100,10 @@
</script>
<!-- Hotjar Tracking Code for ant.design -->
<script>
(function(h, o, t, j, a, r) {
(function (h, o, t, j, a, r) {
h.hj =
h.hj ||
function() {
function () {
(h.hj.q = h.hj.q || []).push(arguments);
};
h._hjSettings = { hjid: 473408, hjsv: 5 };

View File

@ -332,22 +332,18 @@ ${parsedSourceCode.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>