Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,14 @@ export default function useBlockDropZone( {
( sourceRootClientId === '' &&
targetRootClientId === undefined );

const draggedBlockCount = sourceClientIds.length;

// If the block is kept at the same level and moved downwards,
// subtract to account for blocks shifting upward to occupy its old position.
// subtract to take into account that the blocks being dragged
// were removed from the block list.
const insertIndex =
isAtSameLevel && sourceBlockIndex < targetBlockIndex
? targetBlockIndex - 1
? targetBlockIndex - draggedBlockCount
: targetBlockIndex;

moveBlocksToPosition(
Expand Down