Hi!
I'm using CKEditor version 3.6.2. in my application and I want to be able to automatically remove some specific tags: script, noscript, iframe, span, etc.
I wrote the following plugin:
CKEDITOR.plugins.add('fourhooks_filter',
{
init: function (editor) {
var pluginName = 'fourhooks_filter';
editor.dataProcessor.dataFilter.addRules({
elements :
{
iframe : function( element )
{
return false;
},
script : function( element )
{
return false;
},
span : function( element )
{
delete element.name;
}
}
});
editor.dataProcessor.htmlFilter.addRules({
elements :
{
iframe : function( element )
{
return false;
},
script : function( element )
{
return false;
},
span : function( element )
{
delete element.name;
}
}
});
}
});
It works for iframe and span but not for script - the script tag remains intact!
Is there another approach to solve this problem?
Any ideas or hints are highly appreciated.
Thanks,
Dragos
Hi, You should think about
Hi, You should think about upgrading your CKEditor version. First of all - in CKEditor 4.1 we introduced the Advanced Content Filter. which may be the easiest solution for you. Second, if I remember correctly not a long ago it was fixed that script tags couldn't be filtered. But still - if you'll use ACF, then you won't need to do this by data processor's filters.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Hi Reinmar,
Hi Reinmar,
Thank you very much for your answer, I will consider upgrading to the latest version.