Skip to content

Commit

Permalink
Allow drag to root
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewserong committed Apr 13, 2023
1 parent e9a779e commit e712757
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,17 @@ export function getListViewDropTarget( blocksData, position ) {
candidateBlockParents.length
);

const targetParentIndex =
Math.max(
Math.min( desiredRelativeLevel, currentLevel - nextLevel ),
1
) - 1;
const targetParentIndex = Math.max(
Math.min( desiredRelativeLevel, currentLevel - nextLevel ),
0
);

if ( candidateBlockParents[ targetParentIndex ] ) {
return {
rootClientId:
candidateBlockParents[ targetParentIndex ].rootClientId,
clientId: candidateBlockData.clientId,
blockIndex: candidateBlockData.index,
blockIndex: candidateBlockData.blockIndex, // TODO: This still isn't quite right.
dropPosition: candidateEdge,
};
}
Expand Down

0 comments on commit e712757

Please sign in to comment.