AlfonsoML/whitelist

data-cke-saved issue fixed

Closed this issue · 2 comments

the issue about the "a" anchor tag breaking I was able to fix by adjusting how "data-cke-saved" is handled. I mentioned this on your blog http://alfonsoml.blogspot.com/2012/05/white-list-of-elements-and-attributes.html

            elements:
            {
                $ : function( element )
                {
                    var config=editor.config;
                    if (!(element.name in config.whitelist_elements))
                    {
                        console.log("Remove Element[" + element.name+"]");
                        // The element (as well as any content or children) is removed.
                        return false;
                    }

                    var whitelistAttributes = config.whitelist_elements[ element.name ].attributes || {};

                    for( var att in element.attributes )
                    {
                        if (
                            !(att in config.whitelist_globalAttributes) && 
                            !(att in whitelistAttributes) &&
                            (att.substr(0,14) != "data-cke-saved")
                        ){
                            console.log("Remove Element["+element.name+"] Attribute[" + att + "]");
                            delete element.attributes[att];
                        }
                    }
                }
            }

Hi Chris.
Thanks to your suggestion it was easy to find the obvious bug in my original code so I've fixed it with a new 1.1 version.

Awesome, happy to hear it helped you out.