1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-08 21:42:24 +03:00

Move processing into renamed function processHtmlforSending

And explain why this fix is necessary
This commit is contained in:
Luke Barnard
2017-06-28 11:49:50 +01:00
parent 69589c19e7
commit f73fa4b49b
2 changed files with 9 additions and 3 deletions

View File

@@ -84,7 +84,13 @@ export function charactersToImageNode(alt, useSvg, ...unicode) {
}
export function stripParagraphs(html: string): string {
export function processHtmlForSending(html: string): string {
// Replace "<br>\n" with "<br>" because the \n is redundant and causes an
// extra newline per line within `<pre>` tags.
// This is a workaround for a bug in draft-js-export-html:
// https://github.com/sstur/draft-js-export-html/issues/62
html = html.replace(/\<br\>\n/g, '<br>');
const contentDiv = document.createElement('div');
contentDiv.innerHTML = html;