Skip to content

Commit

Permalink
Use rootClientId instead of destinationRootClientId
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Oct 30, 2019
1 parent b090164 commit 0fce7cc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/block-editor/src/components/inserter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export default compose( [
withDispatch( ( dispatch, ownProps, { select } ) => {
return {
insertOnlyAllowedBlock() {
const { rootClientId, clientId, isAppender, destinationRootClientId } = ownProps;
const { rootClientId, clientId, isAppender } = ownProps;
const {
hasSingleBlockType,
allowedBlockType,
Expand All @@ -176,17 +176,17 @@ export default compose( [

// If the clientId is defined, we insert at the position of the block.
if ( clientId ) {
return getBlockIndex( clientId, destinationRootClientId );
return getBlockIndex( clientId, rootClientId );
}

// If there a selected block, we insert after the selected block.
const end = getBlockSelectionEnd();
if ( ! isAppender && end ) {
return getBlockIndex( end, destinationRootClientId ) + 1;
return getBlockIndex( end, rootClientId ) + 1;
}

// Otherwise, we insert at the end of the current rootClientId
return getBlockOrder( destinationRootClientId ).length;
return getBlockOrder( rootClientId ).length;
}

const {
Expand Down

0 comments on commit 0fce7cc

Please sign in to comment.