electron-index.html 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta
  6. http-equiv="Content-Security-Policy"
  7. content="default-src 'none'; script-src file: 'sha256-AcqnkP3xWRYJaQ27hijK3b831+qsxvzEoSYt6PfGrRE='; style-src 'unsafe-inline' file:; font-src file:"
  8. />
  9. <title>Monaco Editor!</title>
  10. <style>
  11. #container {
  12. width: 500px;
  13. height: 300px;
  14. border: 1px solid #ccc;
  15. }
  16. </style>
  17. </head>
  18. <body>
  19. <h1>Monaco Editor in Electron (without nodeIntegration)!</h1>
  20. Note: Since Electron without nodeIntegration is very similar to a browser, you can have a look
  21. at all the other `browser-` samples, as they should work just fine. <br /><br />
  22. <div id="container"></div>
  23. </body>
  24. <script src="../node_modules/monaco-editor/min/vs/loader.js"></script>
  25. <script>
  26. require.config({ paths: { vs: '../node_modules/monaco-editor/min/vs' } });
  27. require(['vs/editor/editor.main'], function () {
  28. const editor = monaco.editor.create(document.getElementById('container'), {
  29. value: ['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
  30. language: 'javascript'
  31. });
  32. });
  33. </script>
  34. </html>