import { useBlockProps } from '@wordpress/block-editor'; import { registerBlockType } from '@wordpress/blocks'; import { TextControl } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; const Edit = ({ attributes, setAttributes }) => { const blockProps = useBlockProps(); return (
setAttributes({ linkText: value })} />
); }; const Save = ({ attributes }) => { const blockProps = useBlockProps.save(); return (
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} {attributes.linkText}
); }; registerBlockType('ally/custom-link', { title: __('Ally Widget Trigger', 'pojo-accessibility'), icon: 'admin-links', category: 'widgets', attributes: { linkText: { type: 'string', default: __('Open Ally Widget', 'pojo-accessibility'), }, }, edit: Edit, save: Save, });