Skip to content

Commit

Permalink
List: fix merging nested lists
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Jul 25, 2023
1 parent f6834cc commit ac56135
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/block-library/src/list-item/hooks/use-merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,14 @@ export default function useMerge( clientId, onMerge ) {
} else if ( previousBlockClientId ) {
const trailingId = getTrailingId( previousBlockClientId );
registry.batch( () => {
moveBlocksToPosition(
getBlockOrder( clientId ),
clientId,
previousBlockClientId
);
const [ nestedListClientId ] = getBlockOrder( clientId );
if ( nestedListClientId ) {
moveBlocksToPosition(
getBlockOrder( nestedListClientId ),
nestedListClientId,
getBlockRootClientId( trailingId )
);
}
mergeBlocks( trailingId, clientId );
} );
} else {
Expand Down

0 comments on commit ac56135

Please sign in to comment.