Docs: Add ancestor property to block-registration.md doc#45832
Merged
Conversation
|
|
skorasaurus
suggested changes
Dec 30, 2022
Member
skorasaurus
left a comment
There was a problem hiding this comment.
Thanks for the addition. A couple suggested corrections as follows:
skorasaurus
reviewed
Dec 30, 2022
|
|
||
| - **Type:** `Array` | ||
|
|
||
| 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. |
Member
There was a problem hiding this comment.
should be comparison , not comparrison.
|
|
||
| ```js | ||
| // Only allow this block when it is nested in a Columns block | ||
| parent: [ 'core/columns' ], |
Member
There was a problem hiding this comment.
The example that is immediately below your addition should be ancestor, not parent; since the code example that you added at line 256 is for the parent attribute; not the ancestor attribute.
gziolo
reviewed
Feb 2, 2023
gziolo
reviewed
Feb 2, 2023
gziolo
reviewed
Feb 2, 2023
gziolo
reviewed
Feb 2, 2023
gziolo
approved these changes
Feb 2, 2023
Member
gziolo
left a comment
There was a problem hiding this comment.
Thank you for adding missing information in the documentation.
Member
thanks for following up with the fixes to get this in the documentation! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #39894, the
ancestorproperty had been added to the schema. In #40027, the docs docs/how-to-guides/block-tutorial/nested-blocks-inner-blocks.md and docs/reference-guides/block-api/block-metadata.md have been updated accordingly. Looking at https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/, I noticed that the new property hasn't been added there.What?
This PR aims to document the
ancestorproperty on https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/.Why?
This PR is necessary as the
ancestorproperty is missing on this particular doc.How?
This PR only contains textual changes within one particular *.md file.
Testing Instructions