2017-09-10 17:25:29 +05:30
|
|
|
<script>
|
2022-10-11 01:57:18 +05:30
|
|
|
import MarkdownField from '~/vue_shared/components/markdown/field.vue';
|
2022-06-21 17:19:12 +05:30
|
|
|
import { helpPagePath } from '~/helpers/help_page_helper';
|
2022-11-25 23:54:43 +05:30
|
|
|
import MarkdownEditor from '~/vue_shared/components/markdown/markdown_editor.vue';
|
|
|
|
import glFeaturesFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
|
2021-03-11 19:13:27 +05:30
|
|
|
import updateMixin from '../../mixins/update';
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
export default {
|
|
|
|
components: {
|
2022-10-11 01:57:18 +05:30
|
|
|
MarkdownField,
|
2022-11-25 23:54:43 +05:30
|
|
|
MarkdownEditor,
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
2022-11-25 23:54:43 +05:30
|
|
|
mixins: [updateMixin, glFeaturesFlagMixin()],
|
2018-12-13 13:39:08 +05:30
|
|
|
props: {
|
2022-06-21 17:19:12 +05:30
|
|
|
value: {
|
|
|
|
type: String,
|
2018-12-13 13:39:08 +05:30
|
|
|
required: true,
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
markdownPreviewPath: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
markdownDocsPath: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
canAttachFile: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
enableAutocomplete: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
},
|
2022-06-21 17:19:12 +05:30
|
|
|
computed: {
|
|
|
|
quickActionsDocsPath() {
|
|
|
|
return helpPagePath('user/project/quick_actions');
|
|
|
|
},
|
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
mounted() {
|
2022-11-25 23:54:43 +05:30
|
|
|
this.focus();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
focus() {
|
|
|
|
this.$refs.textarea?.focus();
|
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
};
|
2017-09-10 17:25:29 +05:30
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="common-note-form">
|
2019-09-30 21:07:59 +05:30
|
|
|
<label class="sr-only" for="issue-description">{{ __('Description') }}</label>
|
2022-11-25 23:54:43 +05:30
|
|
|
<markdown-editor
|
|
|
|
v-if="glFeatures.contentEditorOnIssues"
|
|
|
|
class="gl-mt-3"
|
|
|
|
:value="value"
|
|
|
|
:render-markdown-path="markdownPreviewPath"
|
|
|
|
:markdown-docs-path="markdownDocsPath"
|
|
|
|
:form-field-aria-label="__('Description')"
|
|
|
|
:form-field-placeholder="__('Write a comment or drag your files here…')"
|
|
|
|
form-field-id="issue-description"
|
|
|
|
form-field-name="issue-description"
|
|
|
|
:quick-actions-docs-path="quickActionsDocsPath"
|
|
|
|
:enable-autocomplete="enableAutocomplete"
|
|
|
|
supports-quick-actions
|
2023-03-04 22:38:38 +05:30
|
|
|
use-bottom-toolbar
|
2023-01-13 00:05:48 +05:30
|
|
|
autofocus
|
2022-11-25 23:54:43 +05:30
|
|
|
@input="$emit('input', $event)"
|
|
|
|
@keydown.meta.enter="updateIssuable"
|
|
|
|
@keydown.ctrl.enter="updateIssuable"
|
|
|
|
/>
|
2017-09-10 17:25:29 +05:30
|
|
|
<markdown-field
|
2022-11-25 23:54:43 +05:30
|
|
|
v-else
|
2018-03-17 18:26:18 +05:30
|
|
|
:markdown-preview-path="markdownPreviewPath"
|
|
|
|
:markdown-docs-path="markdownDocsPath"
|
2022-06-21 17:19:12 +05:30
|
|
|
:quick-actions-docs-path="quickActionsDocsPath"
|
2018-03-17 18:26:18 +05:30
|
|
|
:can-attach-file="canAttachFile"
|
|
|
|
:enable-autocomplete="enableAutocomplete"
|
2022-06-21 17:19:12 +05:30
|
|
|
:textarea-value="value"
|
2018-03-17 18:26:18 +05:30
|
|
|
>
|
2020-05-24 23:13:21 +05:30
|
|
|
<template #textarea>
|
|
|
|
<textarea
|
|
|
|
id="issue-description"
|
|
|
|
ref="textarea"
|
2022-06-21 17:19:12 +05:30
|
|
|
:value="value"
|
2022-08-13 15:12:31 +05:30
|
|
|
class="note-textarea js-gfm-input js-autosize markdown-area"
|
|
|
|
data-qa-selector="description_field"
|
2020-05-24 23:13:21 +05:30
|
|
|
dir="auto"
|
2022-04-04 11:22:00 +05:30
|
|
|
data-supports-quick-actions="true"
|
2020-05-24 23:13:21 +05:30
|
|
|
:aria-label="__('Description')"
|
|
|
|
:placeholder="__('Write a comment or drag your files here…')"
|
2022-06-21 17:19:12 +05:30
|
|
|
@input="$emit('input', $event.target.value)"
|
2020-05-24 23:13:21 +05:30
|
|
|
@keydown.meta.enter="updateIssuable"
|
|
|
|
@keydown.ctrl.enter="updateIssuable"
|
|
|
|
>
|
|
|
|
</textarea>
|
|
|
|
</template>
|
2017-09-10 17:25:29 +05:30
|
|
|
</markdown-field>
|
|
|
|
</div>
|
|
|
|
</template>
|