@wordpress/block-library
Version:
Block library for the WordPress editor.
25 lines (20 loc) • 520 B
JavaScript
/**
* External dependencies
*/
import classnames from 'classnames';
/**
* WordPress dependencies
*/
import { RichText, useBlockProps } from '@wordpress/block-editor';
export default function save( { attributes } ) {
const { textAlign, content, level } = attributes;
const TagName = 'h' + level;
const className = classnames( {
[ `has-text-align-${ textAlign }` ]: textAlign,
} );
return (
<TagName { ...useBlockProps.save( { className } ) }>
<RichText.Content value={ content } />
</TagName>
);
}