regression: preview format text for edge cases (#5172)

This commit is contained in:
Reinaldo Neto 2023-08-17 16:44:41 -03:00 committed by GitHub
parent 96bb25e5b4
commit f5da42aae4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -8,8 +8,11 @@ export const previewFormatText = (msg: string) => {
let m = formatText(msg);
m = formatHyperlink(m);
m = shortnameToUnicode(m);
// Removes sequential empty spaces before to use removeMarkdown,
// because with some edge cases the library takes a long time to finish the process
m = m.replace(/\s+/g, ' ');
m = removeMarkdown(m);
// Removes sequential empty spaces
// Removes sequential empty spaces to remove leading empty space on quotes at the rooms list view
m = m.replace(/\s+/g, ' ');
m = m.replace(/\n+/g, ' ');
return m;