import { __ } from "@wordpress/i18n"; import { useBlockProps, RichText, MediaReplaceFlow, InspectorControls, __experimentalLinkControl as LinkControl, useSetting, InnerBlocks, MediaPlaceholder, } from "@wordpress/block-editor"; import { PanelBody, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, Button, CheckboxControl, SelectControl, } from "@wordpress/components"; import "./editor.scss"; import { lock, trash } from "@wordpress/icons"; import CoverImage from "./Cover"; export default function Edit({ attributes, setAttributes }) { const { coverId, coverUrl, coverAlt, coverPosition, hasCover, blackWhiteCoverFilter, aspectRatio, } = attributes; const colors = useSetting("color.palette.theme"); function setCoverAttributes(cover) { setAttributes({ coverId: cover.id, coverAlt: cover.alt, coverUrl: cover.url, }); } function removeCoverAttributes() { setAttributes({ coverId: null, coverAlt: null, coverUrl: null, }); } // Déterminer l'ordre des éléments basé sur la position const shouldShowCoverLeft = hasCover && coverPosition === "left"; const shouldShowCoverRight = hasCover && coverPosition === "right"; return ( <> setAttributes({ hasCover: value })} /> {coverUrl && {coverAlt}} {hasCover && (
{coverUrl && ( <>
)}
{shouldShowCoverLeft && ( )}
{shouldShowCoverRight && ( )}
); }