import { __ } from "@wordpress/i18n"; import { useBlockProps, InnerBlocks, useSetting, InspectorControls, MediaReplaceFlow, MediaPlaceholder, } from "@wordpress/block-editor"; import "./editor.scss"; import { PanelBody, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, Button, CheckboxControl, ColorPalette, } from "@wordpress/components"; export default function Edit({ attributes, setAttributes, ...props }) { const colors = useSetting("color.palette.theme"); const { hasBackgroundColor, backgroundColor, textColor } = attributes; function onBackgroundColorChange(value) { setAttributes({ backgroundColor: value }); } function onHasBackgroundColorChange(value) { setAttributes({ hasBackgroundColor: value }); if (!value) { setAttributes({ backgroundColor: null }); } } function onTextColorChange(value) { setAttributes({ textColor: value }); } return ( <> {hasBackgroundColor && ( <> )} {hasBackgroundColor && ( <> )}
); }