mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 07:00:11 +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
6
.github/workflows/website.yml
vendored
6
.github/workflows/website.yml
vendored
|
|
@ -44,15 +44,15 @@ jobs:
|
||||||
|
|
||||||
- name: Install website node modules
|
- name: Install website node modules
|
||||||
working-directory: website
|
working-directory: website
|
||||||
run: yarn install --frozen-lockfile
|
run: npm ci
|
||||||
|
|
||||||
- name: Install most recent version of monaco-editor
|
- name: Install most recent version of monaco-editor
|
||||||
working-directory: website
|
working-directory: website
|
||||||
run: yarn add monaco-editor
|
run: npm install monaco-editor
|
||||||
|
|
||||||
- name: Build website
|
- name: Build website
|
||||||
working-directory: website
|
working-directory: website
|
||||||
run: yarn run build
|
run: npm run build
|
||||||
|
|
||||||
- name: Setup Pages
|
- name: Setup Pages
|
||||||
uses: actions/configure-pages@v5
|
uses: actions/configure-pages@v5
|
||||||
|
|
|
||||||
6492
website/package-lock.json
generated
Normal file
6492
website/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -25,7 +25,7 @@
|
||||||
"mini-css-extract-plugin": "^2.6.1",
|
"mini-css-extract-plugin": "^2.6.1",
|
||||||
"mobx": "^5.15.4",
|
"mobx": "^5.15.4",
|
||||||
"mobx-react": "^6.2.2",
|
"mobx-react": "^6.2.2",
|
||||||
"monaco-editor": "^0.53.0",
|
"monaco-editor": "^0.55.0-dev-20251008",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-bootstrap": "^2.4.0",
|
"react-bootstrap": "^2.4.0",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,30 @@ import {
|
||||||
} from "../../../shared";
|
} from "../../../shared";
|
||||||
import { Button } from "react-bootstrap";
|
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
|
@observer
|
||||||
export class Preview extends React.Component<{
|
export class Preview extends React.Component<{
|
||||||
model: PlaygroundModel;
|
model: PlaygroundModel;
|
||||||
|
|
@ -54,7 +78,9 @@ export class Preview extends React.Component<{
|
||||||
sandbox="allow-scripts allow-modals"
|
sandbox="allow-scripts allow-modals"
|
||||||
frameBorder={0}
|
frameBorder={0}
|
||||||
ref={this.handleIframe}
|
ref={this.handleIframe}
|
||||||
src="./playgroundRunner.html"
|
src={`https://isolated-playground.github.io/?jsSrcBase64=${btoa(
|
||||||
|
jsSrc
|
||||||
|
)}`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -90,11 +90,6 @@ module.exports = {
|
||||||
filename: "playground.html",
|
filename: "playground.html",
|
||||||
templateContent: getHtml(),
|
templateContent: getHtml(),
|
||||||
}),
|
}),
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
chunks: ["playgroundRunner"],
|
|
||||||
filename: "playgroundRunner.html",
|
|
||||||
templateContent: getHtml(),
|
|
||||||
}),
|
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
chunks: ["index"],
|
chunks: ["index"],
|
||||||
filename: "docs.html",
|
filename: "docs.html",
|
||||||
|
|
|
||||||
3619
website/yarn.lock
3619
website/yarn.lock
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue