fix: Render line-breaks properly in messages (#2699)

This commit is contained in:
Pranav Raj S 2021-08-02 08:24:08 +05:30 committed by GitHub
parent bfa00cc12d
commit 5b3339cd33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 4 deletions

View file

@ -144,7 +144,6 @@ export default {
text_content: { full: fullTextContent, reply: replyTextContent } = {},
} = {},
} = this.contentAttributes;
let contentToBeParsed =
replyHTMLContent ||
replyTextContent ||
@ -154,7 +153,7 @@ export default {
if (contentToBeParsed && this.isIncoming) {
const parsedContent = this.stripStyleCharacters(contentToBeParsed);
if (parsedContent) {
return parsedContent;
return parsedContent.replace(/\n/g, '<br />');
}
}
return (

View file

@ -29,7 +29,7 @@
export default {
props: {
emailAttributes: {
type: Array,
type: Object,
default: () => ({}),
},
isIncoming: {

View file

@ -47,7 +47,7 @@ class MessageFormatter {
const markedDownOutput = marked(withHash);
return markedDownOutput;
}
return marked(this.message);
return marked(this.message, { breaks: true, gfm: true });
}
get formattedMessage() {

View file

@ -126,5 +126,9 @@ export default {
margin-top: $space-normal;
}
}
p:not(:last-child) {
margin-bottom: $space-normal;
}
}
</style>