timdown/rangy

Highlight characterRange ignores linebreaks and empty paragraphs, selectCharacters doesn't

stillnotsure opened this issue · 1 comments

If you have a body of text where the first element is a line break, followed by "abc", highlighting 'a' produces a characterRange of 0-1, showing that it has ignored the line break.

Then, Using rangy.getSelection().selectCharacters on that same character range, no text is selected, because it is trying to select the line-break at position 0.

I could just be using this wrong, but if not this inconsistent behaviour is very confusing.

same problem when using highlighter module.