mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 12:45:39 +01:00
Move into monaco-editor-samples folder
This commit is contained in:
parent
b9969d41cb
commit
a9ab892f7a
86 changed files with 0 additions and 0 deletions
2
monaco-editor-samples/browser-esm-parcel/.gitignore
vendored
Normal file
2
monaco-editor-samples/browser-esm-parcel/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
dist/
|
||||
.cache
|
||||
26
monaco-editor-samples/browser-esm-parcel/index.html
Normal file
26
monaco-editor-samples/browser-esm-parcel/index.html
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<h2>Monaco Editor Parcel Bundler Sample</h2>
|
||||
|
||||
This sample shows how to load a small subset of the editor:
|
||||
<ul>
|
||||
<li>Only the core editor and the find widget</li>
|
||||
<li>Only the json language coloring</li>
|
||||
</ul>
|
||||
|
||||
To run this sample, you need to:
|
||||
|
||||
<pre>
|
||||
$/browser-esm-parcel> npm install .
|
||||
$/browser-esm-parcel> npm run build
|
||||
$/browser-esm-parcel> npm run simpleserver
|
||||
</pre
|
||||
>
|
||||
|
||||
Then, open <a href="http://localhost:9999/">http://localhost:9999/</a>.
|
||||
</body>
|
||||
</html>
|
||||
6983
monaco-editor-samples/browser-esm-parcel/package-lock.json
generated
Normal file
6983
monaco-editor-samples/browser-esm-parcel/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
17
monaco-editor-samples/browser-esm-parcel/package.json
Normal file
17
monaco-editor-samples/browser-esm-parcel/package.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "helloworld",
|
||||
"dependencies": {},
|
||||
"scripts": {
|
||||
"simpleserver": "node ../node_modules/yaserver/bin/yaserver --root ./dist --port 9999",
|
||||
"build": "npm run build-index && npm run build-json && npm run build-css && npm run build-html && npm run build-ts && npm run build-worker",
|
||||
"build-index": "parcel build src/index.html",
|
||||
"build-json": "parcel build ../node_modules/monaco-editor/esm/vs/language/json/json.worker.js --no-source-maps",
|
||||
"build-css": "parcel build ../node_modules/monaco-editor/esm/vs/language/css/css.worker.js --no-source-maps",
|
||||
"build-html": "parcel build ../node_modules/monaco-editor/esm/vs/language/html/html.worker.js --no-source-maps",
|
||||
"build-ts": "parcel build ../node_modules/monaco-editor/esm/vs/language/typescript/ts.worker.js --no-source-maps",
|
||||
"build-worker": "parcel build ../node_modules/monaco-editor/esm/vs/editor/editor.worker.js --no-source-maps"
|
||||
},
|
||||
"devDependencies": {
|
||||
"parcel": "^1.12.4"
|
||||
}
|
||||
}
|
||||
11
monaco-editor-samples/browser-esm-parcel/src/index.html
Normal file
11
monaco-editor-samples/browser-esm-parcel/src/index.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="container" style="width: 800px; height: 600px; border: 1px solid #ccc"></div>
|
||||
|
||||
<script src="index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
24
monaco-editor-samples/browser-esm-parcel/src/index.js
Normal file
24
monaco-editor-samples/browser-esm-parcel/src/index.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.main.js';
|
||||
|
||||
self.MonacoEnvironment = {
|
||||
getWorkerUrl: function (moduleId, label) {
|
||||
if (label === 'json') {
|
||||
return './json.worker.js';
|
||||
}
|
||||
if (label === 'css' || label === 'scss' || label === 'less') {
|
||||
return './css.worker.js';
|
||||
}
|
||||
if (label === 'html' || label === 'handlebars' || label === 'razor') {
|
||||
return './html.worker.js';
|
||||
}
|
||||
if (label === 'typescript' || label === 'javascript') {
|
||||
return './ts.worker.js';
|
||||
}
|
||||
return './editor.worker.js';
|
||||
}
|
||||
};
|
||||
|
||||
monaco.editor.create(document.getElementById('container'), {
|
||||
value: ['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
|
||||
language: 'javascript'
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue