debian-mirror-gitlab/app/assets/javascripts/issuable_show/components/issuable_description.vue

53 lines
1.1 KiB
Vue
Raw Normal View History

2021-01-03 14:25:43 +05:30
<script>
import { GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
2021-03-11 19:13:27 +05:30
import $ from 'jquery';
2021-01-03 14:25:43 +05:30
import '~/behaviors/markdown/render_gfm';
export default {
directives: {
SafeHtml,
},
props: {
issuable: {
type: Object,
required: true,
},
2021-04-17 20:07:23 +05:30
enableTaskList: {
type: Boolean,
required: true,
},
canEdit: {
type: Boolean,
required: true,
},
taskListUpdatePath: {
type: String,
required: true,
},
2021-01-03 14:25:43 +05:30
},
mounted() {
this.renderGFM();
},
methods: {
renderGFM() {
$(this.$refs.gfmContainer).renderGFM();
},
},
};
</script>
<template>
2021-04-17 20:07:23 +05:30
<div class="description" :class="{ 'js-task-list-container': canEdit && enableTaskList }">
2021-01-03 14:25:43 +05:30
<div ref="gfmContainer" v-safe-html="issuable.descriptionHtml" class="md"></div>
2021-04-17 20:07:23 +05:30
<textarea
v-if="issuable.description && enableTaskList"
ref="textarea"
:value="issuable.description"
:data-update-url="taskListUpdatePath"
class="gl-display-none js-task-list-field"
dir="auto"
>
</textarea>
2021-01-03 14:25:43 +05:30
</div>
</template>