Skip to content
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

Merged
merged 2 commits into from
Feb 2, 2023

Conversation

nielslange
Copy link
Contributor

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

  1. Look up the changed *.md file.
  2. Verify that the information is accurate.

@codesandbox
Copy link

codesandbox bot commented Nov 17, 2022

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@skorasaurus skorasaurus added [Type] Developer Documentation Documentation for developers Needs User Documentation Needs new user documentation labels Nov 17, 2022
@gziolo gziolo added the [Feature] Block API API that allows to express the block paradigm. label Nov 21, 2022
Copy link
Member

@skorasaurus skorasaurus left a 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.
Copy link
Member

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.

Copy link
Member

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' ],
Copy link
Member

@skorasaurus skorasaurus Dec 30, 2022

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.

Copy link
Member

Choose a reason for hiding this comment

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

Fixed.

Copy link
Member

@gziolo gziolo left a 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.

@gziolo gziolo merged commit 5d2a294 into WordPress:trunk Feb 2, 2023
@gziolo gziolo changed the title Add ancestor property to block-registration.md doc Docs: Add ancestor property to block-registration.md doc Feb 2, 2023
@github-actions github-actions bot added this to the Gutenberg 15.2 milestone Feb 2, 2023
@skorasaurus
Copy link
Member

Thank you for adding missing information in the documentation.

thanks for following up with the fixes to get this in the documentation!

@femkreations femkreations removed the Needs User Documentation Needs new user documentation label Jun 14, 2023
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. [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants