Skip to content

Commit

Permalink
Restore the inner div of the group block in the editor for classic th…
Browse files Browse the repository at this point in the history
…emes (#30453)
  • Loading branch information
youknowriad committed Apr 1, 2021
1 parent a58a6f5 commit 172152b
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions packages/block-library/src/group/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,22 @@ function GroupEdit( { attributes, setAttributes, clientId } ) {
? [ 'wide', 'full' ]
: [ 'left', 'center', 'right' ];
const blockProps = useBlockProps();
const innerBlocksProps = useInnerBlocksProps( blockProps, {
templateLock,
renderAppender: hasInnerBlocks
? undefined
: InnerBlocks.ButtonBlockAppender,
__experimentalLayout: {
type: 'default',
// Find a way to inject this in the support flag code (hooks).
alignments: themeSupportsLayout ? alignments : undefined,
},
} );
const innerBlocksProps = useInnerBlocksProps(
themeSupportsLayout
? blockProps
: { className: 'wp-block-group__inner-container' },
{
templateLock,
renderAppender: hasInnerBlocks
? undefined
: InnerBlocks.ButtonBlockAppender,
__experimentalLayout: {
type: 'default',
// Find a way to inject this in the support flag code (hooks).
alignments: themeSupportsLayout ? alignments : undefined,
},
}
);

return (
<>
Expand All @@ -66,7 +71,14 @@ function GroupEdit( { attributes, setAttributes, clientId } ) {
}
/>
</InspectorAdvancedControls>
<TagName { ...innerBlocksProps } />
{ themeSupportsLayout && <TagName { ...innerBlocksProps } /> }
{ /* Ideally this is not needed but it's there for backward compatibility reason
to keep this div for themes that might rely on its presence */ }
{ ! themeSupportsLayout && (
<TagName { ...blockProps }>
<div { ...innerBlocksProps } />
</TagName>
) }
</>
);
}
Expand Down

0 comments on commit 172152b

Please sign in to comment.