This commit is contained in:
zlwu committed 2026-09-28 10:49:53 +08:00
1 parent b9b4cc2673
commit 4928e00423
28 files changed
+12299 -11102

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
import DOMPurify from 'dompurify'
/**
* 消毒富文本 HTML,供 v-html 安全渲染。
* 保留常见排版/图片标签,剥离 script、事件属性等。
*/
export function sanitizeHtml(dirty: string | null | undefined): string {
if (!dirty) return ''
return DOMPurify.sanitize(String(dirty), {
USE_PROFILES: { html: true }
})
}