import { __ } from "@wordpress/i18n";
import {
useBlockProps,
RichText,
InspectorControls,
__experimentalLinkControl as LinkControl,
useSetting,
} from "@wordpress/block-editor";
import { PanelBody } from "@wordpress/components";
import "./editor.scss";
import { BlockControls, AlignmentToolbar } from "@wordpress/block-editor";
import { ColorPalette, PanelRow } from "@wordpress/components";
import { Tip } from "@wordpress/components";
import { ReactComponent as ArrowIcon } from "./img/carhop-fleche-lien-externe-full.svg";
import { ReactComponent as AnchorIcon } from "./img/carhop-fleche-ancre-page.svg";
export default function Edit({ attributes, setAttributes }) {
const { color, link } = attributes;
const colors = useSetting("color.palette.theme");
const isHashLink = typeof link?.url === "string" && link.url.startsWith("#");
function handleColorChange(value) {
setAttributes({ color: value });
}
console.log(attributes);
console.log(link);
function handleLinkChange(newLink) {
if (!newLink) {
setAttributes({ link: undefined });
return;
}
if (newLink.url) {
newLink.title = newLink.url;
}
console.log(newLink);
setAttributes({ link: newLink });
}
return (
<>