Return at the new line into the Pop-up (#1267)

Add regex to replace "\r\n" or "\r" or "\n" by <br/>
This commit is contained in:
grégoire parant 2021-07-07 16:42:26 +02:00 committed by GitHub
parent e5f7c62e25
commit 17525e1e15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,7 +25,7 @@ export class HtmlUtils {
} }
public static escapeHtml(html: string): string { public static escapeHtml(html: string): string {
const text = document.createTextNode(html); const text = document.createTextNode(html.replace(/(\r\n|\r|\n)/g,'<br/>'));
const p = document.createElement('p'); const p = document.createElement('p');
p.appendChild(text); p.appendChild(text);
return p.innerHTML; return p.innerHTML;