import { createElement } from '@wordpress/element' import { BlockControls, BlockAlignmentControl, AlignmentControl, } from '@wordpress/block-editor' import TagNameDropdown from './TagNameDropdown' import { fieldIsImageLike } from '../utils' const AlignmentControls = ({ fieldDescriptor, attributes, attributes: { align, imageAlign }, setAttributes, }) => { return ( {!fieldIsImageLike(fieldDescriptor) ? ( <> setAttributes({ align: newAlign, }) } /> setAttributes({ tagName })} /> ) : ( setAttributes({ imageAlign: newImageAlign, }) } /> )} ) } export default AlignmentControls