summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/issues/show/components/fields/description.vue
blob: d5ac7b28afc0e0fac29a8ff1ef9291b05481e25f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<script>
import markdownField from '~/vue_shared/components/markdown/field.vue';
import updateMixin from '../../mixins/update';

export default {
  components: {
    markdownField,
  },
  mixins: [updateMixin],
  props: {
    formState: {
      type: Object,
      required: true,
    },
    markdownPreviewPath: {
      type: String,
      required: true,
    },
    markdownDocsPath: {
      type: String,
      required: true,
    },
    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"
      :can-attach-file="canAttachFile"
      :enable-autocomplete="enableAutocomplete"
      :textarea-value="formState.description"
    >
      <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>