mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 20:38:55 +03:00
Merge pull request #4114 from matrix-org/revert-4008-fix-markdown-escapes
Revert "Fix escaped markdown passing backslashes through"
This commit is contained in:
commit
bac0ec6e37
2 changed files with 0 additions and 14 deletions
|
@ -41,14 +41,6 @@ export function htmlSerializeIfNeeded(model, {forceHTML = false} = {}) {
|
||||||
if (!parser.isPlainText() || forceHTML) {
|
if (!parser.isPlainText() || forceHTML) {
|
||||||
return parser.toHTML();
|
return parser.toHTML();
|
||||||
}
|
}
|
||||||
// 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/2870
|
|
||||||
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) {
|
||||||
|
|
|
@ -43,10 +43,4 @@ describe('editor/serialize', function() {
|
||||||
const html = htmlSerializeIfNeeded(model, {});
|
const html = htmlSerializeIfNeeded(model, {});
|
||||||
expect(html).toBe("<em>hello</em> world");
|
expect(html).toBe("<em>hello</em> world");
|
||||||
});
|
});
|
||||||
it('escaped markdown should not retain backslashes', function() {
|
|
||||||
const pc = createPartCreator();
|
|
||||||
const model = new EditorModel([pc.plain('\\*hello\\* world')]);
|
|
||||||
const html = htmlSerializeIfNeeded(model, {});
|
|
||||||
expect(html).toBe('*hello* world');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue