monaco-editor/docs/integrate-amd.md

29 lines
832 B
Markdown
Raw Permalink Normal View History

2018-03-14 21:44:58 +08:00
## Integrating the AMD version of the Monaco Editor
Here is the most basic HTML page that embeds the editor using AMD.
2021-11-17 06:18:23 +08:00
More self-contained samples are available in the [samples folder](../samples/).
2018-03-14 21:44:58 +08:00
```html
<!DOCTYPE html>
<html>
2021-11-06 07:15:13 +08:00
<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 grey"></div>
2018-03-14 21:44:58 +08:00
2021-11-06 07:15:13 +08:00
<script src="monaco-editor/min/vs/loader.js"></script>
<script>
require.config({ paths: { vs: 'monaco-editor/min/vs' } });
require(['vs/editor/editor.main'], function () {
var editor = monaco.editor.create(document.getElementById('container'), {
value: ['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
language: 'javascript'
});
});
</script>
</body>
2018-03-14 21:44:58 +08:00
</html>
2020-02-14 00:07:01 +08:00
```