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

snippet_description_edit.vue « components « snippets « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 93d52890675a143fb933cd2db365f477f7a2c6cc (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 { GlFormInput } from '@gitlab/ui';
import setupCollapsibleInputs from '~/snippet/collapsible_input';
import MarkdownField from '~/vue_shared/components/markdown/field.vue';

export default {
  components: {
    GlFormInput,
    MarkdownField,
  },
  props: {
    markdownPreviewPath: {
      type: String,
      required: true,
    },
    markdownDocsPath: {
      type: String,
      required: true,
    },
    value: {
      type: String,
      required: false,
      default: '',
    },
  },
  mounted() {
    setupCollapsibleInputs();
  },
};
</script>
<template>
  <div class="form-group js-description-input">
    <label for="snippet-description">{{ s__('Snippets|Description (optional)') }}</label>
    <div class="js-collapsible-input">
      <div class="js-collapsed" :class="{ 'd-none': value }">
        <gl-form-input
          class="form-control"
          :placeholder="s__('Snippets|Describe what your snippet does or how to use it…')"
          data-testid="description-placeholder"
        />
      </div>
      <markdown-field
        class="js-expanded"
        :class="{ 'd-none': !value }"
        :add-spacing-classes="false"
        :markdown-preview-path="markdownPreviewPath"
        :markdown-docs-path="markdownDocsPath"
        :textarea-value="value"
      >
        <template #textarea>
          <textarea
            id="snippet-description"
            ref="textarea"
            :value="value"
            class="note-textarea js-gfm-input js-autosize markdown-area"
            dir="auto"
            data-testid="snippet-description-field"
            data-supports-quick-actions="false"
            :aria-label="__('Description')"
            :placeholder="__('Write a comment or drag your files here…')"
            v-bind="$attrs"
            @input="$emit('input', $event.target.value)"
          >
          </textarea>
        </template>
      </markdown-field>
    </div>
  </div>
</template>