mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 22:02:55 +01:00
Add requirejs sample
This commit is contained in:
parent
ba79244d69
commit
b321f94acd
2 changed files with 29 additions and 0 deletions
|
|
@ -9,6 +9,7 @@
|
||||||
<h2>Monaco Editor Sample</h2>
|
<h2>Monaco Editor Sample</h2>
|
||||||
<div id="container" style="width:800px;height:600px;border:1px solid grey"></div>
|
<div id="container" style="width:800px;height:600px;border:1px solid grey"></div>
|
||||||
|
|
||||||
|
<!-- OR ANY OTHER AMD LOADER HERE INSTEAD OF loader.js -->
|
||||||
<script src="../node_modules/monaco-editor/min/vs/loader.js"></script>
|
<script src="../node_modules/monaco-editor/min/vs/loader.js"></script>
|
||||||
<script>
|
<script>
|
||||||
require.config({ paths: { 'vs': '../node_modules/monaco-editor/min/vs' }});
|
require.config({ paths: { 'vs': '../node_modules/monaco-editor/min/vs' }});
|
||||||
|
|
|
||||||
28
browser-amd-requirejs/index.html
Normal file
28
browser-amd-requirejs/index.html
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h2>Monaco Editor Sample - Loading with requirejs</h2>
|
||||||
|
<div id="container" style="width:800px;height:600px;border:1px solid grey"></div>
|
||||||
|
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js" integrity="sha256-0SGl1PJNDyJwcV5T+weg2zpEMrh7xvlwO4oXgvZCeZk=" crossorigin="anonymous"></script>
|
||||||
|
<script>
|
||||||
|
require.config({ paths: { 'vs': '../node_modules/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>
|
||||||
|
</html>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue