medium-draft
medium-draft copied to clipboard
When creating a link on the last word of a block, the link continue to extend (see gif)
The gif is quite self explanatory.

Thanks for the great tool!!
This behavior is the default in draft js. One workaround can be to call toggleLink twice, once with the selection and the next with selection collapsed. Or maybe there's a better way.
Maybe the solution would be to do the same as for the bold and italic.
You create your link, if you continue to write right after link, the link expands. If you select a part of the link, the toolbar shows up the link button is activated. If you click on the link button, you unlink the section you've selected.
With this solution, you can't modify the URL once it has been created. You'll need to select the entire link, unlink it, and click again to create a new link. But I don't think it is too weird.
What do you think ?
But Bold, Italic also continues to be extended if it is at the last. If you make your last word B/I, and then continue writing in same or new line, new characters are also bold.
A solution could be to detect a space and toggle B I U, Link automatically or maybe toggle it anyway.
Current process is nothing but what draft docs state, RichUtils.toggleInlineStyle and RichUtils.toggleLink. But this needs to be modified so that new characters don't carry over the style just like I have modified RETURN presses so that new lines after header blocks are always unstyled.