monaco-editor/samples/electron-amd/electron-index.html

38 lines
1.1 KiB
HTML
Raw Normal View History

2020-09-02 23:35:10 +08:00
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
2020-09-21 20:07:25 +08:00
<meta
http-equiv="Content-Security-Policy"
2020-09-21 20:31:41 +08:00
content="default-src 'none'; script-src file: 'sha256-AcqnkP3xWRYJaQ27hijK3b831+qsxvzEoSYt6PfGrRE='; style-src 'unsafe-inline' file:; font-src file:"
2020-09-21 20:07:25 +08:00
/>
2020-09-02 23:35:10 +08:00
<title>Monaco Editor!</title>
2020-09-21 20:07:25 +08:00
<style>
#container {
width: 500px;
height: 300px;
border: 1px solid #ccc;
}
</style>
2020-09-02 23:35:10 +08:00
</head>
<body>
<h1>Monaco Editor in Electron (without nodeIntegration)!</h1>
2020-09-21 20:31:41 +08:00
Note: Since Electron without nodeIntegration is very similar to a browser, you can have a look
at all the other `browser-` samples, as they should work just fine. <br /><br />
2020-09-21 20:07:25 +08:00
<div id="container"></div>
2020-09-02 23:35:10 +08:00
</body>
2020-09-21 20:07:25 +08:00
<script src="../node_modules/monaco-editor/min/vs/loader.js"></script>
2020-09-02 23:35:10 +08:00
<script>
require.config({ paths: { vs: '../node_modules/monaco-editor/min/vs' } });
require(['vs/editor/editor.main'], function () {
2020-09-21 20:31:41 +08:00
const editor = monaco.editor.create(document.getElementById('container'), {
value: ['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
language: 'javascript'
});
2020-09-02 23:35:10 +08:00
});
</script>
</html>