Log in or register to post comments
Last post
zest's picture
Joined: 04/01/2012
Posts: 2
ckeditor remove tag attributes
Hello,

Please, is there anybody that could tell me how to prevent ckeditor to strip tag's attributes.

I add some span tags in the editor but ckeditor remove the class attributes of my span.

I didn't find anything in documentation about this.

Thanks by advance

zest
Airzebeth's picture
Joined: 17/04/2013
Posts: 1
I think I found a way to work

I think I found a way to work this out.

Indeed, each time you load the editor, it remove all class atributes. It does so even if you select "source", add a class, then unselect "source", then select "source" again, you'll see that your class have vanished.

But I noticed that if you defined a class in the style file (ckeditor.styles.js) the way below, you can add it via the style menu in the toolbar and this way, the class remains :

          {
                    name : 'My style name',
                    element : 'your html tag',
                    attributes :
                    {
                            'class' : 'your class name'
                    }
            },

Hope that'll help !

Anna's picture
Joined: 14/12/2010
Posts: 1497
If you are using CKEditor 4.1

If you are using CKEditor 4.1, this is probably because you did not configure the Advanced Content Filter settings. See the release blog post as well as some resources linked in it.

Documentation Manager, CKSource

See CKEditor 4.x docs, CKEditor 3.x docs, CKFinder docs for help. CKEditor general FAQ is useful, too!
If you think you found a bug in CKEditor, read this!