| 1 |
import classnames from 'classnames/dedupe'; |
| 2 |
|
| 3 |
import { RichText, useBlockProps } from '@wordpress/block-editor'; |
| 4 |
|
| 5 |
/** |
| 6 |
* Block Save Class. |
| 7 |
* |
| 8 |
* @param props |
| 9 |
*/ |
| 10 |
export default function BlockSave(props) { |
| 11 |
const { url, srcset, alt, width, height, caption } = props.attributes; |
| 12 |
|
| 13 |
let { className } = props.attributes; |
| 14 |
|
| 15 |
className = classnames('ghostkit-gif', className); |
| 16 |
|
| 17 |
const blockProps = useBlockProps.save({ className }); |
| 18 |
|
| 19 |
return ( |
| 20 |
<figure {...blockProps}> |
| 21 |
<img |
| 22 |
src={url} |
| 23 |
srcSet={srcset} |
| 24 |
alt={alt} |
| 25 |
width={width} |
| 26 |
height={height} |
| 27 |
/> |
| 28 |
{!RichText.isEmpty(caption) ? ( |
| 29 |
<RichText.Content |
| 30 |
className="ghostkit-gif-caption" |
| 31 |
tagName="figcaption" |
| 32 |
value={caption} |
| 33 |
/> |
| 34 |
) : null} |
| 35 |
</figure> |
| 36 |
); |
| 37 |
} |
| 38 |
|