1

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?

Amos M. Carpenter
  • 4,848
  • 4
  • 42
  • 72
medBouzid
  • 7,484
  • 10
  • 56
  • 86
  • 1
    I take it you mean Opera Presto? Because this works fine in Opera Blink as far as I can tell. Any particular reason you need to support an outdated browser version? – Amos M. Carpenter May 17 '16 at 09:20
  • @AmosM.Carpenter oh really ? I didn't know about Presto or Blink as I am not fun of Opera, I think you're right because I've checked my Opera version and it's v12 lol I've installed it in linux via package manager and have no thought that it will install an outdated version. I think I will upgrade! – medBouzid May 17 '16 at 14:25
  • So As pointed by @AmosM.Carpenter I was using an outdated opera version. upgrading to a recent version of opera solve this. – medBouzid May 17 '16 at 14:57
  • Glad it's now working :-) – Amos M. Carpenter May 17 '16 at 14:58

0 Answers0