Merge dev, add translation
This commit is contained in:
@@ -33,18 +33,21 @@ export class HtmlUtils {
|
||||
return p.innerHTML;
|
||||
}
|
||||
|
||||
public static sanitize(html : string) {
|
||||
return sanitizeHtml(html, {
|
||||
allowedAttributes: {
|
||||
'span': ['style'],
|
||||
},
|
||||
allowedStyles: {
|
||||
'span': {
|
||||
'color': [/^#(0x)?[0-9a-f]+$/i, /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/],
|
||||
'font-size': [/^\d+(?:px|em|%)$/]
|
||||
public static sanitize(html : string | number | boolean | undefined): string {
|
||||
if (typeof html === "string") {
|
||||
return sanitizeHtml(html, {
|
||||
allowedAttributes: {
|
||||
'span': ['style'],
|
||||
},
|
||||
allowedStyles: {
|
||||
'span': {
|
||||
'color': [/^#(0x)?[0-9a-f]+$/i, /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/],
|
||||
'font-size': [/^\d+(?:px|em|%)$/]
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static urlify(text: string, style: string = ""): string {
|
||||
|
||||
Reference in New Issue
Block a user