summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pages/projects/ci/lints/ci_lint_editor.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/pages/projects/ci/lints/ci_lint_editor.js')
-rw-r--r--app/assets/javascripts/pages/projects/ci/lints/ci_lint_editor.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/assets/javascripts/pages/projects/ci/lints/ci_lint_editor.js b/app/assets/javascripts/pages/projects/ci/lints/ci_lint_editor.js
new file mode 100644
index 00000000000..9ab73be80a0
--- /dev/null
+++ b/app/assets/javascripts/pages/projects/ci/lints/ci_lint_editor.js
@@ -0,0 +1,19 @@
+export default class CILintEditor {
+ constructor() {
+ this.editor = window.ace.edit('ci-editor');
+ this.textarea = document.querySelector('#content');
+ this.clearYml = document.querySelector('.clear-yml');
+
+ this.editor.getSession().setMode('ace/mode/yaml');
+ this.editor.on('input', () => {
+ const content = this.editor.getSession().getValue();
+ this.textarea.value = content;
+ });
+
+ this.clearYml.addEventListener('click', this.clear.bind(this));
+ }
+
+ clear() {
+ this.editor.setValue('');
+ }
+}