Skip to content

Commit

Permalink
Update documentation for setGroupingBlockName (#49670)
Browse files Browse the repository at this point in the history
* Update documentation for setGroupingBlockName

* Add explainer text for setGroupingBlockName

Add extra explainer text on what setGroupingBlockName does and that it needs to be executed once the DOM is fully loaded.

* generate updated docs
  • Loading branch information
aurooba committed Apr 9, 2023
1 parent 4fa2a87 commit 7810f7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/blocks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,10 @@ _Parameters_
Assigns name of block for handling block grouping interactions.
This function lets you select a different block to group other blocks in instead of the
default `core/group` block. This function must be used in a component or when the DOM is fully
loaded. See <https://developer.wordpress.org/block-editor/reference-guides/packages/packages-dom-ready/>
_Usage_
```js
Expand All @@ -919,7 +923,7 @@ import { setGroupingBlockName } from '@wordpress/blocks';
const ExampleComponent = () => {
return (
<Button onClick={ () => setGroupingBlockName( 'core/columns' ) }>
{ __( 'Set the default block to Heading' ) }
{ __( 'Wrap in columns' ) }
</Button>
);
};
Expand Down
6 changes: 5 additions & 1 deletion packages/blocks/src/api/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ export function setDefaultBlockName( name ) {
/**
* Assigns name of block for handling block grouping interactions.
*
* This function lets you select a different block to group other blocks in instead of the
* default `core/group` block. This function must be used in a component or when the DOM is fully
* loaded. See https://developer.wordpress.org/block-editor/reference-guides/packages/packages-dom-ready/
*
* @param {string} name Block name.
*
* @example
Expand All @@ -533,7 +537,7 @@ export function setDefaultBlockName( name ) {
*
* return (
* <Button onClick={ () => setGroupingBlockName( 'core/columns' ) }>
* { __( 'Set the default block to Heading' ) }
* { __( 'Wrap in columns' ) }
* </Button>
* );
* };
Expand Down

1 comment on commit 7810f7b

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in 7810f7b.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4649439196
📝 Reported issues:

Please sign in to comment.