mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-09-01 21:00:58 +00:00
* feat(modules): expose host data boundaries * feat(modules): add frontend extension surfaces * refactor(ai): remove assistant from core * chore(ai): prepare the module extraction * fix(modules): load extension styles after the host bundle * chore(modules): lock SDK 3.3.0
18 lines
581 B
TypeScript
18 lines
581 B
TypeScript
import DOMPurify from 'dompurify'
|
|
|
|
/**
|
|
* Sanitize a raw HTML string with DOMPurify's default browser profile
|
|
* (strips <script>, event handlers, javascript: URLs, and every other HTML
|
|
* vector). Use this for HTML that originates from the server, a third-party
|
|
* module registry, or the update server before binding it via v-html — the
|
|
* `BaseSanitizedHtml` component wraps this so feature code never touches
|
|
* v-html directly.
|
|
*/
|
|
export function sanitizeHtml(html: string | null | undefined): string {
|
|
if (!html) {
|
|
return ''
|
|
}
|
|
|
|
return DOMPurify.sanitize(html)
|
|
}
|