admin管理员组

文章数量:1122832

I have a "custom/section" block with a template of "allowedBlocks" innerblocks eg. { children }.

But have been unable to restrict the "custom/section" block from having a Parent block.


I've tried the following settings in the "custom/section" block.json metadata.

{ "parent":[], "ancestor":[] }
//
{ "parent":[""], "ancestor":[""] }
//
{ "parent":["core/post-content"], "ancestor":["core/post-content"] }

This restricts insertion but does not restrict the block from being wrapped in a core/group via the editor block settings.

Multiple instances of the "custom/section" block are allowed so contentOnly lock isn't appropriate.

references:

  1. gutenberg/issues/7845
  2. stackoverflow: how-to-exclude-parent-block-from-group-columns-innerblocks

本文标签: Restrict Block from having a Parent or Ancenstor Block