tinyMCE supports this functionality inside its dom.parser:
tinyMCE.activeEditor.dom.Serializer.addAttributeFilter('class,style', function(nodes, name) {
for (var i = 0; i < nodes.length; i++) {
console.log(nodes[i].name);
tinyMCE.dom.setAttrib(nodes[i], 'class', null);
tinyMCE.dom.setAttrib(nodes[i], 'style', null);
}
});
You can also apply the change to the entire array:
tinyMCE.activeEditor.dom.Serializer.addAttributeFilter('class', function(nodes, name) {
tinyMCE.dom.setAttrib(nodes, 'class', null);
});
tinyMCE.activeEditor.dom.Serializer.addAttributeFilter('style', function(nodes, name) {
tinyMCE.dom.setAttrib(nodes, 'style', null);
});
See here for full feature documentation:
http://www.tinymce.com/wiki.php/API3:namespace.tinymce.dom
zuloo source
share