You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
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:
@@ -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()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user