blob: df635522e94ce6d786ae76fb341d461528f34a22 (
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
|
import EditorLite from '~/editor/editor_lite';
export default class CILintEditor {
constructor() {
this.clearYml = document.querySelector('.clear-yml');
this.clearYml.addEventListener('click', this.clear.bind(this));
return this.initEditorLite();
}
clear() {
this.editor.setValue('');
}
initEditorLite() {
const editorEl = document.getElementById('editor');
const fileContentEl = document.getElementById('content');
const form = document.querySelector('.js-ci-lint-form');
const rootEditor = new EditorLite();
this.editor = rootEditor.createInstance({
el: editorEl,
blobPath: '.gitlab-ci.yml',
blobContent: editorEl.innerText,
});
form.addEventListener('submit', () => {
fileContentEl.value = this.editor.getValue();
});
}
}
|