components
1 year ago
block.json
1 year ago
edit.js
1 year ago
index.js
1 year ago
save.js
1 year ago
save.js
36 lines
| 1 | /** |
| 2 | * WordPress dependencies |
| 3 | */ |
| 4 | import { useBlockProps } from '@wordpress/block-editor'; |
| 5 | import sanitizeSVG from '../../utils/sanitize-svg'; |
| 6 | import { getBlockClasses } from '@utils/getBlockClasses'; |
| 7 | |
| 8 | export function Save( { attributes } ) { |
| 9 | const { |
| 10 | html, |
| 11 | htmlAttributes = {}, |
| 12 | } = attributes; |
| 13 | |
| 14 | const classNames = getBlockClasses( |
| 15 | 'gb-shape', |
| 16 | attributes, |
| 17 | true |
| 18 | ); |
| 19 | |
| 20 | const blockProps = useBlockProps.save( |
| 21 | { |
| 22 | className: classNames.join( ' ' ).trim(), |
| 23 | ...htmlAttributes, |
| 24 | } |
| 25 | ); |
| 26 | |
| 27 | return ( |
| 28 | <span |
| 29 | { ...blockProps } |
| 30 | dangerouslySetInnerHTML={ |
| 31 | { __html: sanitizeSVG( html ) } |
| 32 | } |
| 33 | /> |
| 34 | ); |
| 35 | } |
| 36 |