import { __ } from "@wordpress/i18n";
import { useBlockProps } from "@wordpress/block-editor";
import OptionsSelectControl from "./OptionsSelectControl";
import { useSelect } from "@wordpress/data";
import "./editor.scss";
import arrow from "./img/arrow-right-circle.svg";
export default function Edit({ attributes, setAttributes }) {
const { relatedPostId, postType } = attributes;
const page = useSelect((select) =>
select("core").getEntityRecord("postType", postType, relatedPostId)
);
const pageIconUrl = useSelect(
(select) => {
if (postType === "page") {
if (!page?.acf?.page_icon) return null;
return select("core").getMedia(page?.acf?.page_icon)?.source_url;
}
if (postType === "parcours") {
if (!page?.acf?.step_icon) return null;
return select("core").getMedia(page?.acf?.step_icon)?.source_url;
}
},
[page]
);
return (
<>
{page.excerpt?.raw}
En savoir plus