Search code examples
javascripthtmlcssckeditorwysiwyg

CKEditor multiple style class not working


I have a custom CMS which using CKEditor. There is a big problem when I am adding multiple classes to a class attribute.

<p class="abc xyz">
 //
</p>

I am adding like this, but it renders as,

<p>
 //
</p>

Can I solve this using config.js or something else?


Solution

  • You need to go into the config.js and set

    CKEDITOR.config.allowedContent = true;
    

    This way you will stop the CKEditor from stripping off the classes from your elements.

    Which version of CKEditor are you using? If the problem started happening when you updated CKEditor library to 4.1 then in the "Advanced options" section of CKEditor profile add this:

    config.allowedContent = true;
    

    If you still have problem with this please refer to the CKEditor API Documentation which states everything that you will need about this.