Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/issues/show/components/fields/description.vue')
-rw-r--r--app/assets/javascripts/issues/show/components/fields/description.vue49
1 files changed, 14 insertions, 35 deletions
diff --git a/app/assets/javascripts/issues/show/components/fields/description.vue b/app/assets/javascripts/issues/show/components/fields/description.vue
index c8ea8fb7ab2..a1463d0e911 100644
--- a/app/assets/javascripts/issues/show/components/fields/description.vue
+++ b/app/assets/javascripts/issues/show/components/fields/description.vue
@@ -1,14 +1,13 @@
<script>
import { __ } from '~/locale';
-import MarkdownField from '~/vue_shared/components/markdown/field.vue';
-import { helpPagePath } from '~/helpers/help_page_helper';
import MarkdownEditor from '~/vue_shared/components/markdown/markdown_editor.vue';
import glFeaturesFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
+import { trackSavedUsingEditor } from '~/vue_shared/components/markdown/tracking';
+import { ISSUE_NOTEABLE_TYPE } from '~/notes/constants';
import updateMixin from '../../mixins/update';
export default {
components: {
- MarkdownField,
MarkdownEditor,
},
mixins: [updateMixin, glFeaturesFlagMixin()],
@@ -47,8 +46,8 @@ export default {
};
},
computed: {
- quickActionsDocsPath() {
- return helpPagePath('user/project/quick_actions');
+ autocompleteDataSources() {
+ return gl.GfmAutoComplete?.dataSources;
},
},
mounted() {
@@ -58,6 +57,10 @@ export default {
focus() {
this.$refs.textarea?.focus();
},
+ saveIssuable() {
+ trackSavedUsingEditor(this.$refs.markdownEditor.isContentEditorActive, ISSUE_NOTEABLE_TYPE);
+ this.updateIssuable();
+ },
},
};
</script>
@@ -66,45 +69,21 @@ export default {
<div class="common-note-form">
<label class="sr-only" for="issue-description">{{ __('Description') }}</label>
<markdown-editor
- v-if="glFeatures.contentEditorOnIssues"
+ ref="markdownEditor"
+ :enable-content-editor="Boolean(glFeatures.contentEditorOnIssues)"
class="gl-mt-3"
:value="value"
:render-markdown-path="markdownPreviewPath"
:markdown-docs-path="markdownDocsPath"
:form-field-props="formFieldProps"
- :quick-actions-docs-path="quickActionsDocsPath"
:enable-autocomplete="enableAutocomplete"
+ :autocomplete-data-sources="autocompleteDataSources"
supports-quick-actions
autofocus
+ data-qa-selector="description_field"
@input="$emit('input', $event)"
- @keydown.meta.enter="updateIssuable"
- @keydown.ctrl.enter="updateIssuable"
+ @keydown.meta.enter="saveIssuable"
+ @keydown.ctrl.enter="saveIssuable"
/>
- <markdown-field
- v-else
- class="gl-mt-3"
- :markdown-preview-path="markdownPreviewPath"
- :markdown-docs-path="markdownDocsPath"
- :quick-actions-docs-path="quickActionsDocsPath"
- :can-attach-file="canAttachFile"
- :enable-autocomplete="enableAutocomplete"
- :textarea-value="value"
- >
- <template #textarea>
- <textarea
- v-bind="formFieldProps"
- ref="textarea"
- :value="value"
- class="note-textarea js-gfm-input js-autosize markdown-area"
- data-qa-selector="description_field"
- dir="auto"
- data-supports-quick-actions="true"
- @input="$emit('input', $event.target.value)"
- @keydown.meta.enter="updateIssuable"
- @keydown.ctrl.enter="updateIssuable"
- >
- </textarea>
- </template>
- </markdown-field>
</div>
</template>