The restore()
function does not correctly set neither the caret position nor selection by code
#128
Labels
firefox
A bug in FireFox itself
This is not related only to FireFox!
See a demo of this bug and result of fixing: bug-demo.zip
For the
pos.end
the comparison should always be>=
.For the
pos.start
the comparisons should be:>=
>
>
The two conditions are used to switch necessary comparison:
pos.start !== pos.end
detects programmatic selectionanchorOffset === 0 && focusOffset === 0
detects deletion at the start of a text nodeIt won't fix open #111 and #115 issues. I was messed up with testing related to the issues.
By the way, maybe it worthwhile adding
if (typeof highlight === 'function') highlight(editor, pos)
? It removes dependency on highlighting plugin.The text was updated successfully, but these errors were encountered: