gitlab-org--gitlab-foss/app/assets/javascripts/issues/show/components/fields/description.vue

70 lines
1.8 KiB
Vue
Raw Normal View History

<script>
import markdownField from '~/vue_shared/components/markdown/field.vue';
import updateMixin from '../../mixins/update';
2018-10-10 06:23:54 +00:00
export default {
components: {
markdownField,
},
mixins: [updateMixin],
2018-10-10 06:23:54 +00:00
props: {
formState: {
type: Object,
required: true,
2018-01-05 14:31:01 +00:00
},
2018-10-10 06:23:54 +00:00
markdownPreviewPath: {
type: String,
required: true,
},
2018-10-10 06:23:54 +00:00
markdownDocsPath: {
type: String,
required: true,
},
2018-10-10 06:23:54 +00:00
canAttachFile: {
type: Boolean,
required: false,
default: true,
},
enableAutocomplete: {
type: Boolean,
required: false,
default: true,
},
},
mounted() {
this.$refs.textarea.focus();
},
};
</script>
<template>
<div class="common-note-form">
<label class="sr-only" for="issue-description">{{ __('Description') }}</label>
<markdown-field
:markdown-preview-path="markdownPreviewPath"
:markdown-docs-path="markdownDocsPath"
2017-11-22 23:25:11 +00:00
:can-attach-file="canAttachFile"
:enable-autocomplete="enableAutocomplete"
:textarea-value="formState.description"
2017-11-22 23:25:11 +00:00
>
<template #textarea>
<!-- eslint-disable vue/no-mutating-props -->
<textarea
id="issue-description"
ref="textarea"
v-model="formState.description"
class="note-textarea js-gfm-input js-autosize markdown-area qa-description-textarea"
dir="auto"
data-supports-quick-actions="true"
:aria-label="__('Description')"
:placeholder="__('Write a comment or drag your files here…')"
@keydown.meta.enter="updateIssuable"
@keydown.ctrl.enter="updateIssuable"
>
</textarea>
<!-- eslint-enable vue/no-mutating-props -->
</template>
</markdown-field>
</div>
</template>