| 1 |
import { |
| 2 |
RichText, |
| 3 |
useBlockProps, |
| 4 |
useInnerBlocksProps, |
| 5 |
} from '@wordpress/block-editor'; |
| 6 |
import { applyFilters } from '@wordpress/hooks'; |
| 7 |
|
| 8 |
import metadata from './block.json'; |
| 9 |
|
| 10 |
const { name } = metadata; |
| 11 |
|
| 12 |
/** |
| 13 |
* Block Save Class. |
| 14 |
* |
| 15 |
* @param props |
| 16 |
*/ |
| 17 |
export default function BlockSave(props) { |
| 18 |
const { version, date } = props.attributes; |
| 19 |
|
| 20 |
let className = 'ghostkit-changelog'; |
| 21 |
|
| 22 |
className = applyFilters('ghostkit.blocks.className', className, { |
| 23 |
name, |
| 24 |
...props, |
| 25 |
}); |
| 26 |
|
| 27 |
const blockProps = useBlockProps.save({ className }); |
| 28 |
const innerBlockProps = useInnerBlocksProps.save({ |
| 29 |
className: 'ghostkit-changelog-more', |
| 30 |
}); |
| 31 |
|
| 32 |
return ( |
| 33 |
<div {...blockProps}> |
| 34 |
{!RichText.isEmpty(version) ? ( |
| 35 |
<RichText.Content |
| 36 |
tagName="span" |
| 37 |
className="ghostkit-changelog-version" |
| 38 |
value={version} |
| 39 |
/> |
| 40 |
) : null} |
| 41 |
{!RichText.isEmpty(date) ? ( |
| 42 |
<RichText.Content |
| 43 |
tagName="h2" |
| 44 |
className="ghostkit-changelog-date" |
| 45 |
value={date} |
| 46 |
/> |
| 47 |
) : null} |
| 48 |
<div {...innerBlockProps} /> |
| 49 |
</div> |
| 50 |
); |
| 51 |
} |
| 52 |
|