Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Greetings,
I have spent significant amount of time within CKEditor trying to find some option to stop it from stripping out classes from html tags. I know this problem is specific to CKEditor because if I disable the editor my classes are preserved without any problem. Is this happening to anybody else? How do I solve it? Thanks. Kevin
Comments
Comment #1
steven_kropp CreditAttribution: steven_kropp commentedSame problem here... I toggle source code, wrap my lists with
Also I'm using "Full HTML" text format with the Limit allowed HTML tags un-checked.
I've always been able to do this before—now suddenly I cannot.
Comment #2
pyxio CreditAttribution: pyxio commentedYes. weird thing is it removes the classes but keeps the div. so
<div class="foo"> becomes simply <div>
. I have searched high and low through config settings to find the culprit. nothing works. much to my chagrin i have to change editors because the classes it is wiping out are important for me.Comment #3
steven_kropp CreditAttribution: steven_kropp commentedI found a work around here http://drupal.org/node/1980428 if you still wanted to use CKeditor.
Comment #4
pyxio CreditAttribution: pyxio commentedThanks Steven!
Comment #5
Andrei.Sapeshko CreditAttribution: Andrei.Sapeshko commentedHere is another possible solution.
http://drupal.org/node/2000712
Comment #6
pyxio CreditAttribution: pyxio commentedstill not working 100%. it is improved by disabling advanced content filter. however, it still strips out classes. these are heavily used in bootstrap themes.
Comment #7
prabhatjn CreditAttribution: prabhatjn commentedThis helped me:
CKEDitor removes class names, even with the exception in config
Comment #8
sony.sanjay CreditAttribution: sony.sanjay commentedHi,
If the problem started happening when you updated CKEditor library to 4.1 then in the below suggestion will help you.
Please go to the CKEditor and please go to "Advanced options" section of CKEditor profile add this:
config.allowedContent = true;
Thanks
Sanjay
Comment #9
wotney CreditAttribution: wotney commentedThanks Sanjay, #8 did the trick for me
Comment #10
vokielUsing
config.allowedContent = true;
allows all. Basically it disables ACF (Advanced Content Filter) at all, which is not desired and safe.Better set the
config.allowedContent
, see more at https://ckeditor.com/docs/ckeditor4/latest/guide/dev_advanced_content_filter.html.