From 69589c19e7f822749f5a1664f63ba74b2772a2fc Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 27 Jun 2017 18:33:45 +0100 Subject: [PATCH] Work around draft-js-export-html#62 by post-processing
\n Fixes https://github.com/vector-im/riot-web/issues/4446 by post-processing the output HTML from draft-js-export-html by replacing `
\n` with `
`. This works for content within or outside of `
`. If we replace with `\n` instead, the newlines only apply in `
` tags so we use `
`. --- src/components/views/rooms/MessageComposerInput.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index b05beb2571..cca0a9899c 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -509,7 +509,7 @@ export default class MessageComposerInput extends React.Component { if (this.state.isRichtextEnabled) { contentHTML = HtmlUtils.stripParagraphs( RichText.contentStateToHTML(contentState), - ); + ).replace(/\\n/g, '
'); } else { const md = new Markdown(contentText); if (md.isPlainText()) {