import { __ } from '@wordpress/i18n'; import { PanelBody, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, } from '@wordpress/components'; import { useBlockProps, BlockControls, InspectorControls, AlignmentToolbar, JustifyToolbar, BlockVerticalAlignmentToolbar, } from '@wordpress/block-editor'; const Edit = ( props ) => { const { attributes = {}, setAttributes } = props; const blockProps = useBlockProps( { style: { textAlign: attributes.textAlign, width: '100%', }, } ); const mapAlignItems = { top: 'flex-start', center: 'center', bottom: 'flex-end', }; // classOfDiv to fix align. let classOfDiv = blockProps.className; classOfDiv = classOfDiv .split( ' ' ) .filter( ( cls ) => cls.startsWith( 'align' ) ) .join( ' ' ); return ( <> setAttributes( { textAlign: newAlign } ) } /> setAttributes( { justifyContent: newJustify } ) } /> setAttributes( { alignItems: newAlign } ) } /> { setAttributes( { width: value || '100', } ); } } isBlock={ true } >
); }; export default Edit;