Only return formatted text when necessary (for escaped chars)
Signed-off-by: Bob Rao <bob+git@vulpin.com>
This commit is contained in:
parent
fde30577e4
commit
9cf53aa9d8
1 changed files with 5 additions and 1 deletions
|
@ -44,7 +44,11 @@ export function htmlSerializeIfNeeded(model, {forceHTML = false} = {}) {
|
||||||
// Format "plain" text to ensure removal of backslash escapes
|
// Format "plain" text to ensure removal of backslash escapes
|
||||||
// https://github.com/vector-im/riot-web/issues/11230
|
// https://github.com/vector-im/riot-web/issues/11230
|
||||||
// https://github.com/vector-im/riot-web/issues/2870
|
// https://github.com/vector-im/riot-web/issues/2870
|
||||||
return parser.toPlaintext();
|
const postParsePlaintext = parser.toPlaintext();
|
||||||
|
if (postParsePlaintext !== md) {
|
||||||
|
// only return "formatted" text if it differs from the source text
|
||||||
|
return postParsePlaintext;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function textSerialize(model) {
|
export function textSerialize(model) {
|
||||||
|
|
Loading…
Reference in a new issue