Anshad Vattapoyil
Anshad Vattapoyil

Reputation: 23463

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?

Upvotes: 2

Views: 4953

Answers (2)

Sanchit Gupta
Sanchit Gupta

Reputation: 3224

Following is the complete example for CKEDITOR 4.x if you don't want to modify the config.js file:

HTML

<textarea name="post_content" id="post_content" class="form-control"></textarea>

SCRIPT

CKEDITOR.replace('post_content', {
   allowedContent:true,
});

The above code will allow all tags in the editor.

For more Detail : CK EDITOR Allowed Content Rules

Upvotes: 0

Thanos
Thanos

Reputation: 3059

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.

Upvotes: 6

Related Questions