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

Fix selector import #10330

Merged
merged 1 commit into from
Oct 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/editor/src/components/block-drop-zone/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class BlockDropZone extends Component {
}

onDrop( event, position ) {
const { rootClientId: dstRootClientId, clientId: dstClientId, index: dstIndex, getDescendants } = this.props;
const { rootClientId: dstRootClientId, clientId: dstClientId, index: dstIndex, getClientIdsOfDescendants } = this.props;
const { srcRootClientId, srcClientId, srcIndex, type } = parseDropEvent( event );

const isBlockDropType = ( dropType ) => dropType === 'block';
Expand All @@ -87,7 +87,7 @@ class BlockDropZone extends Component {
return ( srcRoot === dstRoot ) || ( ! srcRoot === true && ! dstRoot === true );
};
const isSameBlock = ( src, dst ) => src === dst;
const isSrcBlockAnAncestorOfDstBlock = ( src, dst ) => getDescendants( [ src ] ).some( ( id ) => id === dst );
const isSrcBlockAnAncestorOfDstBlock = ( src, dst ) => getClientIdsOfDescendants( [ src ] ).some( ( id ) => id === dst );

if ( ! isBlockDropType( type ) ||
isSameBlock( srcClientId, dstClientId ) ||
Expand Down Expand Up @@ -156,10 +156,10 @@ export default compose(
};
} ),
withSelect( ( select, { rootClientId } ) => {
const { getDescendants, getTemplateLock } = select( 'core/editor' );
const { getClientIdsOfDescendants, getTemplateLock } = select( 'core/editor' );
return {
isLocked: !! getTemplateLock( rootClientId ),
getDescendants,
getClientIdsOfDescendants,
};
} )
)( BlockDropZone );