-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introducing InnerBlocks Primitive
- Loading branch information
1 parent
686ea35
commit 00d2f87
Showing
9 changed files
with
53 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
14 changes: 14 additions & 0 deletions
14
packages/block-primitives/src/block-editor/inner-blocks.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { InnerBlocks as GutenbergInnerBlocks, useBlockProps } from '@wordpress/block-editor'; | ||
import { InnerBlocksProps } from '#shared/types.js'; | ||
|
||
const InnerBlocks: React.FC<InnerBlocksProps> = ({ className, ...props }) => { | ||
const blockProps = useBlockProps(); | ||
|
||
return ( | ||
<div {...blockProps} className={[className, blockProps.className].join(' ')}> | ||
<GutenbergInnerBlocks {...props} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default InnerBlocks; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { InnerBlocksProps } from '#shared/types.js'; | ||
|
||
const InnerBlocks: React.FC<InnerBlocksProps> = ({ children, className }) => { | ||
return <div className={className}>{children}</div>; | ||
}; | ||
|
||
export default InnerBlocks; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
import { InnerBlocks } from '@wordpress/block-editor'; | ||
|
||
/** | ||
* See https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-edit-save/#save | ||
* | ||
* @returns {null} Dynamic blocks do not save the HTML. | ||
*/ | ||
const ExampleBlockSave = () => null; | ||
const ExampleBlockSave = () => { | ||
return <InnerBlocks.Content />; | ||
}; | ||
|
||
export default ExampleBlockSave; |