2020-03-10 09:08:10 +00:00
|
|
|
<script>
|
|
|
|
import { GlFormInput } from '@gitlab/ui';
|
|
|
|
import MarkdownField from '~/vue_shared/components/markdown/field.vue';
|
|
|
|
import setupCollapsibleInputs from '~/snippet/collapsible_input';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
GlFormInput,
|
|
|
|
MarkdownField,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
markdownPreviewPath: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
markdownDocsPath: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
2020-04-01 09:07:45 +00:00
|
|
|
value: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
|
|
|
},
|
2020-03-10 09:08:10 +00:00
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
setupCollapsibleInputs();
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<div class="form-group js-description-input">
|
2020-06-15 12:08:44 +00:00
|
|
|
<label for="snippet-description">{{ s__('Snippets|Description (optional)') }}</label>
|
2020-03-10 09:08:10 +00:00
|
|
|
<div class="js-collapsible-input">
|
2020-04-01 09:07:45 +00:00
|
|
|
<div class="js-collapsed" :class="{ 'd-none': value }">
|
2020-03-10 09:08:10 +00:00
|
|
|
<gl-form-input
|
|
|
|
class="form-control"
|
|
|
|
:placeholder="
|
|
|
|
s__(
|
|
|
|
'Snippets|Optionally add a description about what your snippet does or how to use it…',
|
|
|
|
)
|
|
|
|
"
|
|
|
|
data-qa-selector="description_placeholder"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<markdown-field
|
|
|
|
class="js-expanded"
|
2020-04-01 09:07:45 +00:00
|
|
|
:class="{ 'd-none': !value }"
|
2020-06-15 12:08:44 +00:00
|
|
|
:add-spacing-classes="false"
|
2020-03-10 09:08:10 +00:00
|
|
|
:markdown-preview-path="markdownPreviewPath"
|
|
|
|
:markdown-docs-path="markdownDocsPath"
|
2020-09-18 21:10:11 +00:00
|
|
|
:textarea-value="value"
|
2020-03-10 09:08:10 +00:00
|
|
|
>
|
2020-06-15 12:08:44 +00:00
|
|
|
<template #textarea>
|
|
|
|
<textarea
|
|
|
|
id="snippet-description"
|
|
|
|
ref="textarea"
|
|
|
|
:value="value"
|
|
|
|
class="note-textarea js-gfm-input js-autosize markdown-area"
|
|
|
|
dir="auto"
|
|
|
|
data-qa-selector="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>
|
2020-03-10 09:08:10 +00:00
|
|
|
</markdown-field>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|