mweiss / elm-rte-toolkit

A toolkit for creating rich text editors in Elm
https://mweiss.github.io/elm-rte-toolkit/
BSD 3-Clause "New" or "Revised" License
149 stars 14 forks source link

Fix removeInRange missing out elements in the range #33

Closed matsjoyce closed 3 years ago

matsjoyce commented 3 years ago

Issue

Copy the below ABCD paragraph + list and paste it into https://mweiss.github.io/elm-rte-toolkit/#/examples/basic.

A

  1. B

  2. C

  3. D

Then select all (Ctrl + A) and then Backspace. The B item is left behind: ## Fix The `removeInRange` function appears to be wrong. In the case that `startIndex /= endIndex`, `leftRest` and `rightRest` are recursively edited between `startRest` and `endRest`, while `leftRest` should be edited between `startRest` and the end of that node, and `rightRest` should be edited between the start of that node and `endRest`.