diff --git a/app/javascript/dashboard/components/widgets/conversation/Message.vue b/app/javascript/dashboard/components/widgets/conversation/Message.vue index e43b8e3e5..d5d6e9edf 100644 --- a/app/javascript/dashboard/components/widgets/conversation/Message.vue +++ b/app/javascript/dashboard/components/widgets/conversation/Message.vue @@ -76,6 +76,8 @@ import contentTypeMixin from 'shared/mixins/contentTypeMixin'; import BubbleActions from './bubble/Actions'; import { MESSAGE_TYPE, MESSAGE_STATUS } from 'shared/constants/messages'; import { generateBotMessageContent } from './helpers/botMessageContentHelper'; +import { stripStyleCharacters } from './helpers/EmailContentParser'; + export default { components: { BubbleActions, @@ -116,12 +118,10 @@ export default { } = this.contentAttributes; if ((replyHTMLContent || fullHTMLContent) && this.isIncoming) { - let parsedContent = new DOMParser().parseFromString( - replyHTMLContent || fullHTMLContent || '', - 'text/html' - ); - if (!parsedContent.getElementsByTagName('parsererror').length) { - return parsedContent.body.innerHTML; + let contentToBeParsed = replyHTMLContent || fullHTMLContent || ''; + const parsedContent = stripStyleCharacters(contentToBeParsed); + if (parsedContent) { + return parsedContent; } } return ( diff --git a/app/javascript/dashboard/components/widgets/conversation/helpers/EmailContentParser.js b/app/javascript/dashboard/components/widgets/conversation/helpers/EmailContentParser.js new file mode 100644 index 000000000..1f716fad1 --- /dev/null +++ b/app/javascript/dashboard/components/widgets/conversation/helpers/EmailContentParser.js @@ -0,0 +1,12 @@ +export const stripStyleCharacters = emailContent => { + let contentToBeParsed = emailContent.replace(/\n