blob: a780cf3596c0891d63f271dd4df43eec2d9188fb (
plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/* global monaco */
import Vue from 'vue';
import Store from './repo_store'
export default class RepoEditor {
constructor() {
this.initMonaco();
this.el = document.getElementById('ide');
}
initMonaco() {
window.require.config({ paths: { vs: '/monaco-editor/min/vs' } });
window.require(['vs/editor/editor.main'], () => {
this.monacoEditor = monaco.editor
.create(
document.getElementById('ide'), {
model: null
}
)
this.initVue();
});
}
initVue() {
const self = this;
const monacoEditor = this.monacoEditor;
this.vue = new Vue({
data: () => Store,
created () {
if(this.blobRaw !== ''){
monacoEditor.setModel(
monaco.editor.createModel(
this.blobRaw,
'plain'
)
);
}
if(this.isTree) {
self.el.styles = 'display: none';
} else {
self.el.styles = 'display: inline-block';
}
},
watch: {
blobRaw() {
if(this.isTree) {
} else {
// this.blobRaw
// console.log('models', editor.getModels())
}
}
}
});
}
}
|