Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
2/n splitting PR #1828: updating removeRangeFromContentState (#1828)
Browse files Browse the repository at this point in the history
Summary:
Splitting this PR into smaller pieces and updating them.

This chunk just makes some improvements/fixes to the removeRangeFromContentState
logic that handles nested blocks.

This is directly taken from mitermayer 's fork, props to him
Pull Request resolved: #1828

Reviewed By: mitermayer

Differential Revision: D9181963

Pulled By: mitermayer

fbshipit-source-id: 98abba5ed76ed00207aafc59afe940dd2eeb3d00
  • Loading branch information
mitermayer authored and facebook-github-bot committed Aug 6, 2018
1 parent 328ddc6 commit a399e43
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/model/transaction/removeRangeFromContentState.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,16 @@ const updateBlockMapLinks = (
// update start block if its retained
transformBlock(startBlock.getKey(), blocks, block =>
block.merge({
nextSibling: getNextValidSibling(startBlock, blocks, originalBlockMap),
prevSibling: getPrevValidSibling(startBlock, blocks, originalBlockMap),
nextSibling: getNextValidSibling(block, blocks, originalBlockMap),
prevSibling: getPrevValidSibling(block, blocks, originalBlockMap),
}),
);

// update endblock if its retained
transformBlock(endBlock.getKey(), blocks, block =>
block.merge({
nextSibling: getNextValidSibling(endBlock, blocks, originalBlockMap),
prevSibling: getPrevValidSibling(endBlock, blocks, originalBlockMap),
nextSibling: getNextValidSibling(block, blocks, originalBlockMap),
prevSibling: getPrevValidSibling(block, blocks, originalBlockMap),
}),
);

Expand All @@ -186,14 +186,14 @@ const updateBlockMapLinks = (
// update start block prev
transformBlock(startBlock.getPrevSiblingKey(), blocks, block =>
block.merge({
nextSibling: getNextValidSibling(startBlock, blocks, originalBlockMap),
nextSibling: getNextValidSibling(block, blocks, originalBlockMap),
}),
);

// update end block next
transformBlock(endBlock.getNextSiblingKey(), blocks, block =>
block.merge({
prevSibling: getPrevValidSibling(endBlock, blocks, originalBlockMap),
prevSibling: getPrevValidSibling(block, blocks, originalBlockMap),
}),
);

Expand Down

0 comments on commit a399e43

Please sign in to comment.