Skip to content

Commit

Permalink
Nest props that are passed to block component
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Mar 2, 2020
1 parent bf12bf3 commit 5b0cdc0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 27 deletions.
8 changes: 4 additions & 4 deletions packages/block-editor/src/components/block-list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ function BlockList(
isDraggable,
renderAppender,
__experimentalUIParts = {},
tagName = 'div',
...props
__experimentalTagName = 'div',
__experimentalPassedProps = {},
},
ref
) {
Expand Down Expand Up @@ -67,7 +67,7 @@ function BlockList(
enableAnimation,
} = useSelect( selector, [ rootClientId ] );

const Container = rootClientId ? tagName : RootContainer;
const Container = rootClientId ? __experimentalTagName : RootContainer;
const targetClientId = useBlockDropZone( {
element: ref,
rootClientId,
Expand All @@ -84,7 +84,7 @@ function BlockList(
className
) }
{ ...__experimentalContainerProps }
{ ...props }
{ ...__experimentalPassedProps }
>
{ blockClientIds.map( ( clientId, index ) => {
const isBlockInSelection = hasMultiSelection
Expand Down
22 changes: 4 additions & 18 deletions packages/block-editor/src/components/inner-blocks/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { pick, isEqual, omit } from 'lodash';
import { pick, isEqual } from 'lodash';
import classnames from 'classnames';

/**
Expand Down Expand Up @@ -150,7 +150,6 @@ class InnerBlocks extends Component {
hasOverlay,
__experimentalCaptureToolbars: captureToolbars,
forwardedRef,
className,
...props
} = this.props;
const { templateInProcess } = this.state;
Expand All @@ -159,34 +158,21 @@ class InnerBlocks extends Component {
return null;
}

const classes = classnames( className, {
const classes = classnames( {
'has-overlay': enableClickThrough && hasOverlay,
'is-capturing-toolbar': captureToolbars,
} );

const blockList = (
<BlockList
{ ...props }
ref={ forwardedRef }
rootClientId={ clientId }
className={ classes }
{ ...omit( props, [
'templateLock',
'isSmallScreen',
'block',
'blockListSettings',
'parentLock',
'isLastBlockChangePersistent',
'replaceInnerBlocks',
'__unstableMarkNextChangeAsNotPersistent',
'updateNestedSettings',
'__experimentalMoverDirection',
'allowedBlocks',
'template',
] ) }
/>
);

if ( props.tagName ) {
if ( props.__experimentalTagName ) {
return blockList;
}

Expand Down
8 changes: 5 additions & 3 deletions packages/block-library/src/column/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ function ColumnEdit( {
? false
: () => <InnerBlocks.ButtonBlockAppender />
}
tagName={ Block.div }
className={ classes }
style={ hasWidth ? { flexBasis: width + '%' } : undefined }
__experimentalTagName={ Block.div }
__experimentalPassedProps={ {
className: classes,
style: hasWidth ? { flexBasis: width + '%' } : undefined,
} }
/>
</>
);
Expand Down
6 changes: 4 additions & 2 deletions packages/block-library/src/columns/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,11 @@ function ColumnsEditContainer( {
<InnerBlocks
allowedBlocks={ ALLOWED_BLOCKS }
__experimentalMoverDirection="horizontal"
tagName={ Block.div }
className={ classes }
ref={ ref }
__experimentalTagName={ Block.div }
__experimentalPassedProps={ {
className: classes,
} }
/>
</TextColor>
</BackgroundColor>
Expand Down

0 comments on commit 5b0cdc0

Please sign in to comment.