Chatwoot/app/javascript/shared/mixins/messageFormatterMixin.js
Nithin David Thomas a5c3c4301c
feat: Add support for markdown in messages (#1642)
Co-authored-by: Pranav <pranav@chatwoot.com>
2021-01-15 14:40:50 +05:30

21 lines
592 B
JavaScript

import MessageFormatter from '../helpers/MessageFormatter';
export default {
methods: {
formatMessage(message, isATweet) {
const messageFormatter = new MessageFormatter(message, isATweet);
return messageFormatter.formattedMessage;
},
getPlainText(message, isATweet) {
const messageFormatter = new MessageFormatter(message, isATweet);
return messageFormatter.plainText;
},
truncateMessage(description = '') {
if (description.length < 100) {
return description;
}
return `${description.slice(0, 97)}...`;
},
},
};