Work around draft-js-export-html#62 by post-processing <br>\n
Fixes https://github.com/vector-im/riot-web/issues/4446 by post-processing the output HTML from draft-js-export-html by replacing `<br>\n` with `<br>`. This works for content within or outside of `<pre>`. If we replace with `\n` instead, the newlines only apply in `<pre>` tags so we use `<br>`.
This commit is contained in:
parent
be60dfdc3a
commit
69589c19e7
1 changed files with 1 additions and 1 deletions
|
@ -509,7 +509,7 @@ export default class MessageComposerInput extends React.Component {
|
||||||
if (this.state.isRichtextEnabled) {
|
if (this.state.isRichtextEnabled) {
|
||||||
contentHTML = HtmlUtils.stripParagraphs(
|
contentHTML = HtmlUtils.stripParagraphs(
|
||||||
RichText.contentStateToHTML(contentState),
|
RichText.contentStateToHTML(contentState),
|
||||||
);
|
).replace(/\<br\>\n/g, '<br>');
|
||||||
} else {
|
} else {
|
||||||
const md = new Markdown(contentText);
|
const md = new Markdown(contentText);
|
||||||
if (md.isPlainText()) {
|
if (md.isPlainText()) {
|
||||||
|
|
Loading…
Reference in a new issue