diff options
Diffstat (limited to 'app/assets/javascripts/pipeline_editor/components/editor/text_editor.vue')
-rw-r--r-- | app/assets/javascripts/pipeline_editor/components/editor/text_editor.vue | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/app/assets/javascripts/pipeline_editor/components/editor/text_editor.vue b/app/assets/javascripts/pipeline_editor/components/editor/text_editor.vue index a3410d7b837..d373f74a5c4 100644 --- a/app/assets/javascripts/pipeline_editor/components/editor/text_editor.vue +++ b/app/assets/javascripts/pipeline_editor/components/editor/text_editor.vue @@ -2,13 +2,15 @@ import { EDITOR_READY_EVENT } from '~/editor/constants'; import { CiSchemaExtension } from '~/editor/extensions/editor_ci_schema_ext'; import EditorLite from '~/vue_shared/components/editor_lite.vue'; +import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import getCommitSha from '../../graphql/queries/client/commit_sha.graphql'; export default { components: { EditorLite, }, - inject: ['ciConfigPath', 'projectPath', 'projectNamespace'], + mixins: [glFeatureFlagMixin()], + inject: ['ciConfigPath', 'projectPath', 'projectNamespace', 'defaultBranch'], inheritAttrs: false, data() { return { @@ -25,14 +27,16 @@ export default { this.$emit('updateCiConfig', content); }, registerCiSchema() { - const editorInstance = this.$refs.editor.getEditor(); + if (this.glFeatures.schemaLinting) { + const editorInstance = this.$refs.editor.getEditor(); - editorInstance.use(new CiSchemaExtension({ instance: editorInstance })); - editorInstance.registerCiSchema({ - projectPath: this.projectPath, - projectNamespace: this.projectNamespace, - ref: this.commitSha, - }); + editorInstance.use(new CiSchemaExtension({ instance: editorInstance })); + editorInstance.registerCiSchema({ + projectPath: this.projectPath, + projectNamespace: this.projectNamespace, + ref: this.commitSha || this.defaultBranch, + }); + } }, }, readyEvent: EDITOR_READY_EVENT, |