When the user finishes to type in a URL in a contenteditable div, I want to autolink it, like Medium does:
Finally found a workaround, without using execCommand
:
range.deleteContents()
range.insertNode(createdLinkNode)
range.setStartAfter(createdLinkNode);
range.setEndAfter(createdLinkNode);
selection.removeAllRanges();
selection.addRange(range);