Skip to content

Commit

Permalink
Don't open the drop area unless the insertion point is visible
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian committed Jul 26, 2024
1 parent 8a80507 commit 442156c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/block-editor/src/components/block-list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,14 @@ function Items( {
sectionRootClientId,
sectionClientIds,
blockInsertionPoint,
blockInsertionPointVisible,
} = useSelect( ( select ) => {
const {
getSettings,
__unstableGetEditorMode,
getBlockInsertionPoint,
getBlockOrder,
isBlockInsertionPointVisible,
} = unlock( select( blockEditorStore ) );

if ( __unstableGetEditorMode() === 'zoom-out' ) {
Expand All @@ -245,6 +247,7 @@ function Items( {
sectionClientIds: sectionRootClientIds,
blockOrder: getBlockOrder( root ),
blockInsertionPoint: getBlockInsertionPoint(),
blockInsertionPointVisible: isBlockInsertionPointVisible(),
};
}
return {};
Expand Down Expand Up @@ -274,12 +277,14 @@ function Items( {

if ( position === 'top' ) {
isVisible =
blockInsertionPointVisible &&
blockInsertionPoint.index === 0 &&
clientId === sectionClientIds[ blockInsertionPoint.index ];
}

if ( position === 'bottom' ) {
isVisible =
blockInsertionPointVisible &&
clientId === sectionClientIds[ blockInsertionPoint.index - 1 ];
}

Expand Down

0 comments on commit 442156c

Please sign in to comment.