Skip to content

Commit e563abb

Browse files
committed
sanitize blocks
1 parent 0eca0c8 commit e563abb

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.config/externals.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ const wpExternals = [
4242
'keyboard-shortcuts',
4343
'token-list',
4444
'keycodes',
45-
'escape-html'
45+
'escape-html',
46+
'dom'
4647
].reduce( ( externals, name ) => ( {
4748
...externals,
4849
[ `@wordpress/${ name }` ]: `wp.${ camelCaseDash( name ) }`,

src/components/design-library-list/design-preview.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
useEffect, createPortal, useRef,
66
} from '@wordpress/element'
77
import { applyFilters } from '@wordpress/hooks'
8+
import { safeHTML } from '@wordpress/dom'
89

910
const NOOP = () => {}
1011

@@ -88,7 +89,7 @@ export const DesignPreview = ( {
8889
className={ shadowBodyClasses }
8990
>
9091
<div
91-
dangerouslySetInnerHTML={ { __html: blocks } }
92+
dangerouslySetInnerHTML={ { __html: safeHTML( blocks ) } }
9293
style={ { pointerEvents: 'none' } } // prevent blocks from being clicked
9394
/>
9495
</body>

0 commit comments

Comments
 (0)