Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,27 @@ export default function useBlockDropZone( {
// Ensure the element is a block. It should have the `wp-block` class.
( element ) => element.classList.contains( 'wp-block' )
);
const targetBlock = () => {
if ( event.srcElement.dataset?.empty === 'true' ) {
return event.target;
}

return false;
};
const targetIndex = getNearestBlockIndex(
blockElements,
{ x: event.clientX, y: event.clientY },
getBlockListSettings( targetRootClientId )?.orientation
);

setTargetBlockIndex( targetIndex === undefined ? 0 : targetIndex );
if ( ! targetBlock() ) {
setTargetBlockIndex(
targetIndex === undefined ? 0 : targetIndex
);

if ( targetIndex !== null ) {
showInsertionPoint( targetRootClientId, targetIndex );
if ( targetIndex !== null ) {
showInsertionPoint( targetRootClientId, targetIndex );
}
}
}, [] ),
200
Expand Down