import { __ } from '@wordpress/i18n'; import { useBlockProps, InnerBlocks, useInnerBlocksProps, InspectorControls } from '@wordpress/block-editor'; import { PanelBody, __experimentalUnitControl as UnitControl } from '@wordpress/components'; import './editor.scss'; export default function Edit(props) { const { attributes, setAttributes } = props; const { maxWidth = '100%' } = attributes; // Default value for maxWidth if not set // Function to handle the change of maxWidth const handleMaxWidthChange = (value) => { setAttributes({ maxWidth: value }); }; const blockProps = useBlockProps(); // Standard block props for the child block const innerBlocksProps = useInnerBlocksProps(blockProps); // Using blockProps for inner block props // Correctly define style as an object const style = { maxWidth: maxWidth, }; return ( <> {/* Inspector Controls for maxWidth */}
{/* UnitControl to adjust maxWidth value */}
{/* Main block content */}
); }