Bug with Adding Link to Text When Dragging the Cursor Outside of the WYSIWYG
There is a bug in the Chrome browser that causes duplicate text and the link that is being created to be moved. The bug can be reproduced by dragging the cursor outside of the editor when selecting text and then trying to add a link to the selected text.
When dragging outside of editor: https://i.gyazo.com/b1c1cb4125fa85e77725b5f2ae820b0c.mp4
When not dragging outside of editor: https://gyazo.com/a8c60c190e09c7e4e9b4c00d94ee0069.mp4
I narrowed this issue down to the setRange() and getRange() methods. When dragging outside of the editor the "startOffset" variable is set to the same value as the "endOffset" instead of the appropriate offset value, which seems to cause the issue.
I have be unsuccessfully so far in determining how the startOffset is being updated to try and account for this bug. I have tested in Firefox and determined that it is not an issue in that browser.
This is an issue that has not been resolved for a long time. I'll try to solve it again while updating the 3.0.0 version.