At the moment, the span elements that make up a multi-line selection
are not necessarily added in the correct "order" (ie from top-left to
bottom-right of the document). Sometimes we may want these in order so
that we can style them using CSS selectors like :first-child.
This works by accident currently in Chrome, but not in Firefox. This
change actively sorts the span elements by their rectangles from
top-to-bottom, and then left-to-right. Note that we ignore right-to-left
text as out-of-scope for this change.
Fixes https://github.com/reedsy/quill-cursors/issues/29
At the moment, the
span
elements that make up a multi-line selection are not necessarily added in the correct "order" (ie from top-left to bottom-right of the document). Sometimes we may want these in order so that we can style them using CSS selectors like:first-child
.This works by accident currently in Chrome, but not in Firefox. This change actively sorts the
span
elements by their rectangles from top-to-bottom, and then left-to-right. Note that we ignore right-to-left text as out-of-scope for this change.