index.html 837 B

1234567891011121314151617181920212223242526
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  5. </head>
  6. <body>
  7. <h2>Monaco Editor Sample - Loading with requirejs</h2>
  8. <div id="container" style="width: 800px; height: 600px; border: 1px solid grey"></div>
  9. <script
  10. src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js"
  11. integrity="sha256-0SGl1PJNDyJwcV5T+weg2zpEMrh7xvlwO4oXgvZCeZk="
  12. crossorigin="anonymous"
  13. ></script>
  14. <script>
  15. require.config({ paths: { vs: '../node_modules/monaco-editor/min/vs' } });
  16. require(['vs/editor/editor.main'], function () {
  17. var editor = monaco.editor.create(document.getElementById('container'), {
  18. value: ['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
  19. language: 'javascript'
  20. });
  21. });
  22. </script>
  23. </body>
  24. </html>