Can I import/borrow a function specific to a Gutenberg core block into my custom block?

210 views Asked by At

I have a custom Gutenberg block with a button, which right now is rendered by RichText. I want this button to be linkable, however, I don't like the rich text toolbar in this case because it allows the user to select partial text, add multiple links, etc. Instead I want the link picker to function like the Gutenberg core Button block (when you use the link picker in the toolbar, it automatically applies the link to the entire button, preventing the selection of partial text.)

In the edit.js of the Button block there is a function called URLPicker that does this (Github link). Is there a way I can use this?

0

There are 0 answers