You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 15, 2021. It is now read-only.
In Firefox 62.0.3, I can't select the last word of a paragraph, then use 'createLink' to wrap that word in an anchor tag. (You can reproduce this in the demo.) It works when using just document.execCommand(), so I suspected it had to do with the createLink-patch in the core plugin.
Firefox's document.getSelection() returns a selection with anchorNode set to a #text node containing the word and focusNode set to the parent
node (and focusOffset set so that the selection ends after the #text node child (= the anchorNode).
Later in the code, the isBefore() helper function is used which does not take into account that child nodes of N come after N in the document, i.e. Selection incorrectly assumes the selection is backwards.
I suggest fixing this by checking isBefore() and Node.contains() in Selection() to prevent wrongly inverting the range. I'll prepare a pull request containing this fix.