[Bug?] Toggling class for img in TinyMCE doesn't work

Member since: 2010

Hi, it seems that TinyMCE has bug related to selecting the class for image since EPi 6 R2 (continuing in EPi 7).

Once we select a class (float-right, for example), when we select float-left, the class is not replaced - it's added to the exising class! So, we end up with

<img class="float-right float-left" ...

The page looks OK, as the second class rewrites the first one. However, if the editor changes his/her mind, they can't get it back to float-right, without opening the image edit modal.

This works just fine, if we delete all EditMenuTitle-s and EditMenuName-s from editor.css. Than, we have the default epi classes, but the classes for images gets toggled instead of concatenated.

Is there a workaround?

#65669 Feb 05, 2013 11:11
  • Member since: 2010

    Any clues?

    #66251 Feb 25, 2013 17:19
  • Member since: 2006

    "Once we select a class (float-right, for example), when we select float-left, the class is not replaced - it's added to the exising class!": If you select first select"

    - If you select float-left, then float-left again it should dissepear, than you can add float-right. You should then end up with:

     <img class="float-right" ...

    Works on my machine :)

    #66280 Edited, Feb 26, 2013 12:04
  • Member since: 2002

    According to the Tiny MCE forum this seems to be the correct behaviour for our setup:

    http://www.tinymce.com/forum/viewtopic.php?id=21691

    #66289 Edited, Feb 26, 2013 14:33
  • Not sure why anybody would mark this sort of behaviour as correct, but I just wanted to note that if you don't use episerver specifics (EditMenuName, EditMenuTitle) in your css for editor, than there is no problem with double classes on elements. Only one class is added and in case you select another one - old one is replaced with new one. But then again if you don't have "EditMenuName" how would you add custom css classes?

    Also, it feels very strange that in above example for image, if image has two css classes - only one is marked as selected in dropdown. Further more if you want to remove one css class from image which already has two classes, first you must remove the class that is added first. Not sure how would I explain that to average user...

    Not sure if this helps you guys, just wanted to share some toughts...

    #66300 Edited, Feb 26, 2013 15:40
  • Member since: 2006

    I think this behaviour is logical. What if I want a class float-left and a class frame-red or something like that. Then this behaviour is nessesary. 

    #66316 Feb 27, 2013 7:58