admin管理员组文章数量:1122846
I want to disable blocks based on some condition eg. An instance of that block is already present in the InnerBlocks (duplicate block). When the user opens the inserter (Quick or in the sidebar Sidebar), they will see all the eligible blocks as well as the disabled blocks but their icon will be "dimmed" and they cannot be inserted, similar to WooCommerce's Checkout Block (as shown in the pic below).
I know I can modify the allowedBlocks
property of the InnerBlock dynamically to control what gets to be inserted. But that method completely removes the block from the inserter. Whereas I need to show the disabled block too, but as "dimmed".
I tried to find how they did in WooCommerce Block's source code but I am unable to find it.
本文标签: Disabling blocks in the Gutenberg block Inserter
版权声明:本文标题:Disabling blocks in the Gutenberg block Inserter 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736309663a1934098.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论