Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
dat-boris committed Aug 1, 2024
1 parent e53b399 commit 0245d63
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/utils/selection-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const trimSelectionLeft = (selection) => {
currentRange = selection.getRangeAt(0);
lastContainer = currentRange.startContainer;
} while (
// check that the modify is indeed moving selection forward
currentRange.startContainer !== lastContainer &&
(!isTextNode(currentRange.startContainer) || isSpace(currentRange.startContainer.textContent[currentRange.startOffset]))
);
Expand All @@ -64,6 +65,7 @@ const trimSelectionRight = (selection) => {
currentRange = selection.getRangeAt(0);
lastContainer = currentRange.startContainer;
} while (
// check that the modify is indeed moving selection forward
currentRange.startContainer !== lastContainer &&
(!isTextNode(currentRange.startContainer) || isSpace(currentRange.startContainer.textContent[currentRange.startOffset]))
);
Expand Down

0 comments on commit 0245d63

Please sign in to comment.