admin管理员组文章数量:1122832
I've created a custom block, and with it, a block variation of the core sub-menu block that allows the custom block to be added to it. I can get the custom block to show up initially in the sub-menu variation, as I can add it to the innerBlocks template. However, that doesn't include it in the 'add block' dialog for the sub-menu variation or allow for it to be dragged in. My instinct is to add the custom block to an 'allowedBlocks' attribute, but I can't find any reference to that in the block variations documentation.
Here's the sub-menu variation code:
registerBlockVariation(
'core/navigation-submenu',
{
name: 'cc-sub-menu',
title: 'Enhanced Sub-menu',
description: 'Allows for additional block types',
icon: 'welcome-widgets-menus',
attributes: { providerNameSlug: 'cc-submenu' },
scope: [ 'block', 'inserter', 'transform' ],
innerBlocks: [
['cc/custom-block'],
['core/paragraph']
],
isActive: ( blockAttributes, variationAttributes ) =>
blockAttributes.providerNameSlug === variationAttributes.providerNameSlug
}
);
I've even dumbed down the above code by removing the custom block and just trying to add a core/paragraph block to the innerBlocks attribute of the submenu variation, and the same problem exists. Is there an allowedBlocks setting on innerBlocks that I can manipulate in this way, or does that functionality not exist at the moment?
本文标签: Add custom block to submenu variation
版权声明:本文标题:Add custom block to submenu variation 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736299535a1930488.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论