import { __ } from "@wordpress/i18n";
import "./editor.scss";
import {
useBlockProps,
MediaPlaceholder,
BlockControls,
InspectorControls,
MediaReplaceFlow,
} from "@wordpress/block-editor";
import {
Button,
ToolbarGroup,
ToolbarButton,
Spinner,
withNotices,
FocalPointPicker,
PanelBody,
Tip,
ToggleControl,
__experimentalToggleGroupControl as ToggleGroupControl,
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
} from "@wordpress/components";
import { trash } from "@wordpress/icons";
export default function Edit({
attributes,
setAttributes,
noticeOperations,
noticeList,
noticeUI,
}) {
const { pictureUrl, pictureAlt, pictureId, pictureCaption } = attributes;
function removePictureImg() {
setAttributes({
pictureUrl: undefined,
pictureId: undefined,
pictureCaption: undefined,
pictureAlt: "",
});
}
function updatePictureImg(image) {
if (!image || !image.url) {
removePictureImg();
}
setAttributes({
pictureUrl: image.url,
pictureId: image.id,
pictureAlt: image.alt,
pictureCaption: image.caption,
});
}
function onUploadError(message) {
noticeOperations.removeAllNotices();
noticeOperations.createErrorNotice(message);
}
return (
<>
Le texte de votre Légende est automatiquement attribué depuis le
champ "Légende" de votre image dans la gallerie des médias
}