mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 13:55:41 +01:00
Uses npm for website, hosts playground runner on https://isolated-playground.github.io for better isolation. (#5034)
This commit is contained in:
parent
e2764eac56
commit
a30f4f9920
6 changed files with 6523 additions and 3629 deletions
|
|
@ -9,6 +9,30 @@ import {
|
|||
} from "../../../shared";
|
||||
import { Button } from "react-bootstrap";
|
||||
|
||||
const jsSrc = `
|
||||
try {
|
||||
const baseUrl = ${JSON.stringify(document.baseURI.toString())};
|
||||
const base = document.createElement('base');
|
||||
base.href = baseUrl;
|
||||
document.head.appendChild(base);
|
||||
|
||||
const scriptRuntime = document.createElement('script');
|
||||
scriptRuntime.src = './runtime.js';
|
||||
document.head.appendChild(scriptRuntime);
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.src = './playgroundRunner.js';
|
||||
document.head.appendChild(script);
|
||||
|
||||
const link = document.createElement('link');
|
||||
link.href = './playgroundRunner.css';
|
||||
link.rel = 'stylesheet';
|
||||
document.head.appendChild(link);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
`;
|
||||
|
||||
@observer
|
||||
export class Preview extends React.Component<{
|
||||
model: PlaygroundModel;
|
||||
|
|
@ -54,7 +78,9 @@ export class Preview extends React.Component<{
|
|||
sandbox="allow-scripts allow-modals"
|
||||
frameBorder={0}
|
||||
ref={this.handleIframe}
|
||||
src="./playgroundRunner.html"
|
||||
src={`https://isolated-playground.github.io/?jsSrcBase64=${btoa(
|
||||
jsSrc
|
||||
)}`}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue