Skip to content

Commit

Permalink
Fix block patterns insertion
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Jan 20, 2021
1 parent 28b1c51 commit 59ecb9f
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ function useInsertionPoint( {
onSelect,
} ) {
const {
selectedBlock,
destinationRootClientId,
destinationIndex,
getSelectedBlock,
} = useSelect(
( select ) => {
const {
getSelectedBlock,
getSelectedBlock: _getSelectedBlock,
getBlockIndex,
getBlockOrder,
getBlockInsertionPoint,
Expand Down Expand Up @@ -79,7 +79,7 @@ function useInsertionPoint( {
}

return {
selectedBlock: getSelectedBlock(),
getSelectedBlock: _getSelectedBlock,
destinationRootClientId: _destinationRootClientId,
destinationIndex: _destinationIndex,
};
Expand All @@ -96,6 +96,8 @@ function useInsertionPoint( {

const onInsertBlocks = useCallback(
( blocks, meta ) => {
const selectedBlock = getSelectedBlock();

if (
! isAppender &&
selectedBlock &&
Expand Down Expand Up @@ -132,7 +134,7 @@ function useInsertionPoint( {
},
[
isAppender,
selectedBlock,
getSelectedBlock,
replaceBlocks,
insertBlocks,
destinationRootClientId,
Expand Down

0 comments on commit 59ecb9f

Please sign in to comment.