diff --git a/blocks/_components/ImageMediaPlaceholder.jsx b/blocks/_components/ImageMediaPlaceholder.jsx index 21e8f78..94bb6ac 100644 --- a/blocks/_components/ImageMediaPlaceholder.jsx +++ b/blocks/_components/ImageMediaPlaceholder.jsx @@ -10,7 +10,6 @@ export default function ImageMediaPlaceholder({ imageId, imageAlt, imageUrl, set } function removeImageAttributes() { - console.log("removeImageAttributes"); setAttributes({ imageId: null, imageAlt: null, diff --git a/blocks/_components/ImagePanelBodyContent.jsx b/blocks/_components/ImagePanelBodyContent.jsx new file mode 100644 index 0000000..2f1c5e4 --- /dev/null +++ b/blocks/_components/ImagePanelBodyContent.jsx @@ -0,0 +1,59 @@ +import { __ } from "@wordpress/i18n"; +import { + PanelBody, + Button, + Tip, + __experimentalToggleGroupControl as ToggleGroupControl, + __experimentalToggleGroupControlOption as ToggleGroupControlOption, +} from "@wordpress/components"; +import { MediaReplaceFlow, MediaPlaceholder } from "@wordpress/block-editor"; +import { trash } from "@wordpress/icons"; + +export default function ImagePanelBody({ imageUrl, imageAlt, imageId, imageProportion, setAttributes }) { + function setImageAttributes(image) { + setAttributes({ + imageId: image.id, + imageAlt: image.alt, + imageUrl: image.url, + }); + } + + function removeImageAttributes() { + setAttributes({ + imageId: null, + imageAlt: null, + imageUrl: null, + }); + } + + return ( + <> + {imageUrl && {imageAlt}} +
+ + {imageUrl && ( + <> +
+ + ); +}