提交
This commit is contained in:
1 parent
b9b4cc2673
commit
4928e00423
28 files changed
+12299
-11102
No files matched your search
@@ -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 }
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user