I can easily do execcommand on a contenteditable selection if using a button. However using any other element fails.
Why is this and how can I make it work using a div element.
Thanks.
I can easily do execcommand on a contenteditable selection if using a button. However using any other element fails.
Why is this and how can I make it work using a div element.
Thanks.
Most, if not all, of the WYSIWYG editors out there use an iframe
element in order to not lose the selection. Another approach, although I haven't tried it, would be to store each selection made on that page after the mouseup
event triggers.
Take a look at this page about Midas, Gecko's built-in rich text editor.
Google Wave doesn't use iFrames, it is purely contenteditable divs, however good luck searching through all their compressed code..