admin管理员组

文章数量:1201401

My InnerBlock child block doesn't seem to respect the block.json "supports" property and I can't understand why not.

For reference, this custom block is comprised of:

  • a parent ucomm-blocks/accordion-block
  • a child ucomm-blocks/accordion-block-item

The relevant parts of their block.json files look like this...

accordion-block.json

{
  "$schema": ".json",
  "apiVersion": 2,
  "name": "ucomm-blocks/accordion-block",
  "title": "Accordion",
  "icon": "menu",
  "category": "ucomm-blocks",
  "allowedBlocks": [
    "ucomm-blocks/accordion-block-item"
  ],
  "attributes": {
    // non-relevant attributes
  }
}

accordion-block-item.json

{
  "$schema": ".json",
  "apiVersion": 2,
  "name": "ucomm-blocks/accordion-block-item",
  "title": "UConn Accordion Item",
  "icon": "menu",
  "category": "ucomm-blocks",
  "parent": [
    "ucomm-blocks/accordion-block"
  ],
  "allowedBlocks": [
    "core/columns",
    "core/cover",
    "core/embed",
    "core/group",
    "core/heading",
    "core/image",
    "core/list",
    "core/paragraph",
    "core/separator",
    "core/spacer"
  ],
  "attributes": {
    "backgroundColor": {
      "type": "string"
    }
  },
  "supports": {
    "anchor": true,
    "color": {
      "background": true,
      "text": true,
      "gradients": false,
      "link": false
    }
  }
}

When I add the supports.color property to the parent, the background/text color picker appears as expected for the parent. However, adding it to the child doesn't appear to do anything. The allowedBlocks of the accordion items all work correctly as well. No errors are thrown regarding the accordion block and I haven't found anything in the documentation that accounts for this. In all other respects these blocks work correctly. What am I doing wrong here?

Thanks for any help you can provide.

本文标签: