Selection is lost when I click bold button in Opera

52 views Asked by At

I have a wysiwyg editor which works good in Chrome and Firefox, but in Opera, when I select text and click a button like "Bold", the selection is lost (even if I prevent the default behavior of mousedown).

This is demonstrated by this fiddle.

Code:

<div id="editor" contenteditable="true">
   Some test text, please select some then press the button
</div>
<div class="bold" onmousedown="document.execCommand('bold',false,null); return false;">Bold</div>

Most of the time, the selection is lost, and rarely not! I am not sure if this is a bug in Opera or something else... so am wondering whether there is a way to solve that?

0

There are 0 answers