有谁知道我可以设置CKEditor的位置,所以添加的所有链接都会有rel ="nofollow",即使用户没有指定它?
您可以按照本页中的说明创建数据过滤器,以检查每个链接:http: //docs.cksource.com/CKEditor_3.x/Developers_Guide/Data_Processor
这个(未经测试的)代码应该或多或少地符合您的需要:
editor.dataProcessor.htmlFilter.addRules(
{
elements :
{
a : function( element )
{
if ( !element.attributes.rel )
element.attributes.rel = 'nofollow';
}
}
});
Run Code Online (Sandbox Code Playgroud)