File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { defineNuxtPlugin } from '#app'
44import { useRuntimeConfig } from '#imports'
55
66export default defineNuxtPlugin ( async ( { vueApp } ) => {
7- const { public : { dompurify : { profiles } } } = useRuntimeConfig ( )
7+ const { public : { dompurify } } = useRuntimeConfig ( )
88
99 let purify : DOMPurify . DOMPurifyI
1010
@@ -17,8 +17,8 @@ export default defineNuxtPlugin(async ({ vueApp }) => {
1717 }
1818
1919 function sanitizeHtml ( binding : DirectiveBinding ) {
20- if ( binding . arg && profiles [ binding . arg ] ) {
21- return purify . sanitize ( binding . value , profiles [ binding . arg ] )
20+ if ( binding . arg && dompurify ?. profiles ?. [ binding . arg ] ) {
21+ return purify . sanitize ( binding . value , dompurify . profiles [ binding . arg ] )
2222 }
2323
2424 return purify . sanitize ( binding . value )
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ export interface ModuleOptions {
6565declare module 'nuxt/schema' {
6666 interface PublicRuntimeConfig {
6767 dompurify : {
68- profiles : Profiles
68+ profiles ? : Profiles
6969 }
7070 }
7171}
You can’t perform that action at this time.
0 commit comments