-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: Add ancestor property to block-registration.md doc #45832
Conversation
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the addition. A couple suggested corrections as follows:
|
||
- **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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be comparison , not comparrison.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
|
||
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. | ||
|
||
|
||
```js | ||
// Only allow this block when it is nested in a Columns block | ||
parent: [ 'core/columns' ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding missing information in the documentation.
thanks for following up with the fixes to get this in the documentation! |
In #39894, the
ancestor
property 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
ancestor
property on https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/.Why?
This PR is necessary as the
ancestor
property is missing on this particular doc.How?
This PR only contains textual changes within one particular *.md file.
Testing Instructions