add DOMPurify
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// import sanitizeHtml from 'sanitize-html';
|
||||
import DOMPurify from 'dompurify';
|
||||
|
||||
export class HtmlUtils {
|
||||
public static getElementByIdOrFail<T extends HTMLElement>(id: string): T {
|
||||
@@ -40,8 +40,8 @@ export class HtmlUtils {
|
||||
|
||||
public static sanitize(html: string | number | boolean | undefined): string {
|
||||
if (typeof html === "string") {
|
||||
return html;
|
||||
/* TODO: fix sanitizer, sanitizeHtml seems not to work with vite
|
||||
return DOMPurify.sanitize(html);
|
||||
/* TODO: fix sanitizer, apply sanitizeHtml rules to DOMPurify
|
||||
return sanitizeHtml(html, {
|
||||
allowedAttributes: {
|
||||
span: ["style"],
|
||||
|
||||
Reference in New Issue
Block a user