admin管理员组文章数量:1279016
I am creating a custom block and I want to show a button which the user can edit the text of and I want them to be able to select a page/enter a link. I have this working but using URLInputButton
does not give the option to open in a new tab like the default wordpress popover when you highlight some text and then choose to add a hyperlink.
This is what I currently have:
<URLInputButton url={url} onChange={onURLChange} />
I have also played around with a popover but not sure how to put what I want in there. This just does what it says and shows text that says 'Popover is toggled!"
<Button variant="secondary" onClick={toggleVisible}>
Toggle Popover!
{isVisible && <Popover>Popover is toggled!</Popover>}
</Button>
I am creating a custom block and I want to show a button which the user can edit the text of and I want them to be able to select a page/enter a link. I have this working but using URLInputButton
does not give the option to open in a new tab like the default wordpress popover when you highlight some text and then choose to add a hyperlink.
This is what I currently have:
<URLInputButton url={url} onChange={onURLChange} />
I have also played around with a popover but not sure how to put what I want in there. This just does what it says and shows text that says 'Popover is toggled!"
<Button variant="secondary" onClick={toggleVisible}>
Toggle Popover!
{isVisible && <Popover>Popover is toggled!</Popover>}
</Button>
Share
Improve this question
asked Nov 16, 2021 at 18:28
user8463989user8463989
5931 gold badge8 silver badges24 bronze badges
1 Answer
Reset to default 1There's no support for such a setting in URLInputButton
/URLInput
and those components are deprecated. Try LinkControl
. It may be helpful to study its use in the core Button block. That seems similar to what you are building.
本文标签: theme developmentShow popover with url and option to open in new window
版权声明:本文标题:theme development - Show popover with url and option to open in new window 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741214960a2359870.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论