Browse Source

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
pull/22709/head
Rustin 5 years ago
committed by GitHub
parent
commit
c806a836e5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      site/theme/static/demo.less
  2. 6
      site/theme/static/template.html
  3. 24
      site/theme/template/Content/Demo/index.jsx

1
site/theme/static/demo.less

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

6
site/theme/static/template.html

@ -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 };

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

@ -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>

Loading…
Cancel
Save