mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 18:32:56 +01:00
Rename to /samples/
This commit is contained in:
parent
c9081ee4f3
commit
091f871e65
85 changed files with 12 additions and 15 deletions
|
|
@ -1,46 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'none'; script-src file: 'sha256-RtE3AqQ1tBhtcwykhJsEKY7jjCqiGy5yH1mRDwu6gEE='; style-src 'unsafe-inline' file:; font-src file:"
|
||||
/>
|
||||
<title>Monaco Editor!</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Monaco Editor in Electron!</h1>
|
||||
<div id="container" style="width: 500px; height: 300px; border: 1px solid #ccc"></div>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
const path = require('path');
|
||||
const amdLoader = require('../node_modules/monaco-editor/min/vs/loader.js');
|
||||
const amdRequire = amdLoader.require;
|
||||
const amdDefine = amdLoader.require.define;
|
||||
|
||||
function uriFromPath(_path) {
|
||||
var pathName = path.resolve(_path).replace(/\\/g, '/');
|
||||
if (pathName.length > 0 && pathName.charAt(0) !== '/') {
|
||||
pathName = '/' + pathName;
|
||||
}
|
||||
return encodeURI('file://' + pathName);
|
||||
}
|
||||
|
||||
amdRequire.config({
|
||||
baseUrl: uriFromPath(path.join(__dirname, '../node_modules/monaco-editor/min'))
|
||||
});
|
||||
|
||||
// workaround monaco-css not understanding the environment
|
||||
self.module = undefined;
|
||||
|
||||
amdRequire(['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>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue