diff options
Diffstat (limited to 'app/assets/javascripts/ci/pipeline_editor/components/editor/text_editor.vue')
-rw-r--r-- | app/assets/javascripts/ci/pipeline_editor/components/editor/text_editor.vue | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/assets/javascripts/ci/pipeline_editor/components/editor/text_editor.vue b/app/assets/javascripts/ci/pipeline_editor/components/editor/text_editor.vue index 891c40482d3..1192f0bf418 100644 --- a/app/assets/javascripts/ci/pipeline_editor/components/editor/text_editor.vue +++ b/app/assets/javascripts/ci/pipeline_editor/components/editor/text_editor.vue @@ -2,6 +2,7 @@ import { EDITOR_READY_EVENT } from '~/editor/constants'; import { CiSchemaExtension } from '~/editor/extensions/source_editor_ci_schema_ext'; import SourceEditor from '~/vue_shared/components/source_editor.vue'; +import eventHub, { SCROLL_EDITOR_TO_BOTTOM } from '~/ci/pipeline_editor/event_hub'; import { SOURCE_EDITOR_DEBOUNCE } from '../../constants'; export default { @@ -16,6 +17,12 @@ export default { }, inject: ['ciConfigPath'], inheritAttrs: false, + created() { + eventHub.$on(SCROLL_EDITOR_TO_BOTTOM, this.scrollEditorToBottom); + }, + beforeDestroy() { + eventHub.$off(SCROLL_EDITOR_TO_BOTTOM, this.scrollEditorToBottom); + }, methods: { onCiConfigUpdate(content) { this.$emit('updateCiConfig', content); @@ -24,6 +31,10 @@ export default { instance.use({ definition: CiSchemaExtension }); instance.registerCiSchema(); }, + scrollEditorToBottom() { + const editor = this.$refs.editor.getEditor(); + editor.setScrollTop(editor.getScrollHeight()); + }, }, readyEvent: EDITOR_READY_EVENT, }; |