feat: Add support for markdown in messages (#1642)

Co-authored-by: Pranav <pranav@chatwoot.com>
This commit is contained in:
Nithin David Thomas
2021-01-15 14:40:50 +05:30
committed by GitHub
parent 5adbc84e0c
commit a5c3c4301c
13 changed files with 208 additions and 40 deletions

View File

@@ -27,7 +27,7 @@
<p v-if="lastMessageInChat" class="conversation--message">
<i v-if="messageByAgent" class="ion-ios-undo message-from-agent"></i>
<span v-if="lastMessageInChat.content">
{{ lastMessageInChat.content }}
{{ parsedLastMessage }}
</span>
<span v-else-if="!lastMessageInChat.attachments">{{ ` ` }}</span>
<span v-else>
@@ -47,6 +47,7 @@
<script>
import { mapGetters } from 'vuex';
import { MESSAGE_TYPE } from 'widget/helpers/constants';
import messageFormatterMixin from 'shared/mixins/messageFormatterMixin';
import Thumbnail from '../Thumbnail';
import conversationMixin from '../../../mixins/conversations';
@@ -59,7 +60,7 @@ export default {
Thumbnail,
},
mixins: [timeMixin, conversationMixin],
mixins: [timeMixin, conversationMixin, messageFormatterMixin],
props: {
activeLabel: {
type: String,
@@ -129,6 +130,10 @@ export default {
const { message_type: messageType } = lastMessage;
return messageType === MESSAGE_TYPE.OUTGOING;
},
parsedLastMessage() {
return this.getPlainText(this.lastMessageInChat.content);
},
},
methods: {