260703_01_FST: First Commit
This commit is contained in:
28
registry/components/kri-editor/utils/sanitizeHtml.ts
Normal file
28
registry/components/kri-editor/utils/sanitizeHtml.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
"use client";
|
||||
|
||||
import DOMPurify from "dompurify";
|
||||
|
||||
const HTML_PROFILE = {
|
||||
USE_PROFILES: {
|
||||
html: true,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export function sanitizeHtml(
|
||||
input: string,
|
||||
): string {
|
||||
if (!input) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return DOMPurify.sanitize(
|
||||
input,
|
||||
HTML_PROFILE,
|
||||
);
|
||||
}
|
||||
|
||||
export function sanitizeHtmlForPreview(
|
||||
input: string,
|
||||
): string {
|
||||
return sanitizeHtml(input);
|
||||
}
|
||||
Reference in New Issue
Block a user