mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 18:32:56 +01:00
28 lines
629 B
JavaScript
28 lines
629 B
JavaScript
import * as monaco from 'monaco-editor';
|
|
|
|
self.MonacoEnvironment = {
|
|
getWorkerUrl: function (moduleId, label) {
|
|
if (label === 'json') {
|
|
return './json.worker.bundle.js';
|
|
}
|
|
if (label === 'css') {
|
|
return './css.worker.bundle.js';
|
|
}
|
|
if (label === 'html') {
|
|
return './html.worker.bundle.js';
|
|
}
|
|
if (label === 'typescript' || label === 'javascript') {
|
|
return './ts.worker.bundle.js';
|
|
}
|
|
return './editor.worker.bundle.js';
|
|
}
|
|
}
|
|
|
|
monaco.editor.create(document.getElementById('container'), {
|
|
value: [
|
|
'function x() {',
|
|
'\tconsole.log("Hello world!");',
|
|
'}'
|
|
].join('\n'),
|
|
language: 'javascript'
|
|
});
|