-
Notifications
You must be signed in to change notification settings - Fork 0
/
MonacoEditor.html
43 lines (42 loc) · 923 Bytes
/
MonacoEditor.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<div ref:editorTarget></div>
<script>
import monaco from "./monacoeditor.js";
export default {
data() {},
helpers: {},
onupdate(updates) {},
ondestroy() {
this.observer.destroy();
},
oncreate() {
let resizeTimer = null;
window.addEventListener(
"resize",
function() {
editor.layout({ height: "1px", width: "1px" });
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
editor.layout();
}, 10);
},
true
);
const editor = monaco.editor.create(this.refs["editorTarget"], {
value: `import { world } from 'clientSource0';`,
language: "javascript",
automaticLayout: false,
theme: "vs-dark"
});
},
computed: {},
methods: {},
events: {}
};
</script>
<style>
ref:editorTarget {
width: 100%;
height: 100%;
background:#242424
}
</style>