[SOLVED][CKEDITOR] Classes and inline css getting stripped after editing contents in ckeditor

| | 1 min read

Recently, I got stuck with a strange issue while using CKEditor. The problem was, When code such as v-aligns for tables or inline styles are added in ckeditor and saved then everthing things works fine, but as soon as the page is edited inline css and classes gets stripped off the content.If you are also facing the same problem then read on to know how to solve this.

Ensure that following filters are enabled for the specified formats.

  1. Full HTMl formats.
    • Convert URLs into links.
    • Convert line breaks into HTML.
    • Correct faulty and chopped off HTML.
  2. Filtered HTML formats.
    • Convert URLs into links.
    • Limit allowed HTML tags.
    • Convert line breaks into HTML.
    • Correct faulty and chopped off HTML.

This issue of classes and inline css getting stripped off must be caused while updating CKEditor library.To solve this in advanced option of ckeditor profile(admin/config/content/ckeditor/edit/Advanced), add the following code in "Custom JavaScript configuration".

    config.allowedContent = true; 
  

Now try editing the contents in ckeditor, hope this helps.