Skip to content

Doc: Add documentation for ancestor property in block metadata#40027

Merged
fabiankaegy merged 3 commits into
trunkfrom
documentation/add-docs-for-ancestor-property
Apr 13, 2022
Merged

Doc: Add documentation for ancestor property in block metadata#40027
fabiankaegy merged 3 commits into
trunkfrom
documentation/add-docs-for-ancestor-property

Conversation

@fabiankaegy
Copy link
Copy Markdown
Member

Adds documentation for the new API added in #39894

Adds documentation for the new API added in #39894
@fabiankaegy fabiankaegy added the [Type] Developer Documentation Documentation for developers label Apr 4, 2022
@fabiankaegy fabiankaegy self-assigned this Apr 4, 2022
{ "ancestor": [ "my-block/product" ] }
```

The `ancestor` property makes a block available inside the specified block types at any position of the ancestor block subtree. That allows, for example, to place a ‘Comment Content’ block inside a ‘Column’ block, as long as ‘Column’ is somewhere within a ‘Comment Template’ block. In comparrison to the `parent` property blocks that specify their `ancestor` can be placed anywhere in the subtree whilst blocks with a specified `parent` need to be direct children.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should double-check that, but I believe that the other difference with the parent property is that ancestor doesn't exclude other blocks from the inserter when inside the scope of the provided ancestors.

@luisherranz luisherranz requested a review from DAreRodz April 4, 2022 13:47
Comment thread docs/reference-guides/block-api/block-metadata.md
Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>
@gziolo gziolo added the [Feature] Block API API that allows to express the block paradigm. label Apr 4, 2022
@gziolo gziolo changed the title Add documentation for ancestor property Doc: Add documentation for ancestor property in block metadata Apr 4, 2022
@gziolo gziolo added the Needs Dev Note Requires a developer note for a major WordPress release cycle label Apr 4, 2022
@gziolo
Copy link
Copy Markdown
Member

gziolo commented Apr 4, 2022

@bph - this new API will require a dev note.

@luisherranz
Copy link
Copy Markdown
Member

I've noticed this section about parent in the inner blocks tutorial, and I've added a reference to ancestors as well in 0921a49.

@gziolo
Copy link
Copy Markdown
Member

gziolo commented Apr 13, 2022

Is there anything missing here? Can we land this PR?

@fabiankaegy fabiankaegy merged commit 409eefc into trunk Apr 13, 2022
@fabiankaegy fabiankaegy deleted the documentation/add-docs-for-ancestor-property branch April 13, 2022 08:45
@github-actions github-actions Bot added this to the Gutenberg 13.1 milestone Apr 13, 2022
@bph
Copy link
Copy Markdown
Contributor

bph commented Apr 19, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Block API API that allows to express the block paradigm. Needs Dev Note Requires a developer note for a major WordPress release cycle [Type] Developer Documentation Documentation for developers

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants