UNPKG

@wordpress/e2e-tests

Version:
31 lines (30 loc) 610 B
( function () { wp.richText.registerFormatType( 'my-plugin/link', { title: 'Custom Link', tagName: 'a', attributes: { url: 'href', }, className: 'my-plugin-link', edit( props ) { return wp.element.createElement( wp.blockEditor.RichTextToolbarButton, { icon: 'admin-links', title: 'Custom Link', onClick() { props.onChange( wp.richText.toggleFormat( props.value, { type: 'my-plugin/link', attributes: { url: 'https://example.com', }, } ) ); }, isActive: props.isActive, } ); }, } ); } )();