I'm working on a wysiwyg editor for my blog application on my website. I've already written some basic editor commands like bolding, italic style and that stuff... Now the problem is, when I wan't to do a command which needs additional information like a hyperlink. I got a div with contentEditable on true and a textbox where I can put in the URL for the hyperlink.
I looked up in this forum and other places but I didn't find any possible solution on how to select text in the editable div, then put the desired url for the hyperlink in the textbox and finally click on a div button to call the document.execCommand("CreateLink", null, $URL);
function in javascript.
Is there a possibility to select the text, then on focusing the textbox, save the position of the start and end of the selection and on clicking the button select the text again, with the saved range positions to affect the hyperlink?