Update escapeHtml
Update escapeHtml in HtmlUtils class to create paragraphe when user have \r\n in popup text Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
This commit is contained in:
parent
e32f433688
commit
da00fa7868
@ -1,3 +1,5 @@
|
|||||||
|
import { blackListManager } from "./BlackListManager";
|
||||||
|
|
||||||
export class HtmlUtils {
|
export class HtmlUtils {
|
||||||
public static getElementByIdOrFail<T extends HTMLElement>(id: string): T {
|
public static getElementByIdOrFail<T extends HTMLElement>(id: string): T {
|
||||||
const elem = document.getElementById(id);
|
const elem = document.getElementById(id);
|
||||||
@ -25,10 +27,14 @@ export class HtmlUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static escapeHtml(html: string): string {
|
public static escapeHtml(html: string): string {
|
||||||
const text = document.createTextNode(html.replace(/(\r\n|\r|\n)/g, "<br/>"));
|
let innerHTML = "";
|
||||||
const p = document.createElement("p");
|
const tabBackLine = html.match(/(\r\n|\r|\n)/g);
|
||||||
p.appendChild(text);
|
for (const text in blackListManager) {
|
||||||
return p.innerHTML;
|
const p = document.createElement("p");
|
||||||
|
p.appendChild(document.createTextNode(text));
|
||||||
|
innerHTML += p.innerHTML;
|
||||||
|
}
|
||||||
|
return innerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static urlify(text: string, style: string = ""): string {
|
public static urlify(text: string, style: string = ""): string {
|
||||||
|
Loading…
Reference in New Issue
Block a user