html - 修改帖子时如何在CKEditor上添加nofollow属性
问题描述
我正在使用CKEditor 4.5.5版本。
我添加下一个代码来添加nofollow。
它工作正常并存储了我的数据库。但是,当我修改帖子时,CKEditorauto-removed ref="nofollow"
属性。
如何在 CKEditor 上加载原点属性?
——写页。添加nofollow代码-
CKEDITOR.on('instanceReady', function () {
CKEDITOR.on('dialogDefinition', function (ev) {
var editor = ev.editor;
editor.dataProcessor.htmlFilter.addRules({
elements: {
a: function (element) {
if (!element.attributes.rel)
element.attributes.rel = 'nofollow';
}
}
});
});
});
解决方案
您需要修改文件ckeditor_config.js
. 添加以下代码:
config.extraAllowedContent = 'a[rel]';
推荐阅读
- angular - 同时测试 Angular 库,包括库组件和示例应用程序
- apache - 如何在支持 SSL 的 Amazon EC2 单实例上托管多个网站?
- react-native - 在标签离开时对本机标签重置做出反应
- c# - 我已经使用了参数,但我很难用多用户登录
- asp.net-mvc - 如果我的基本控制器具有处理 dbcontext 的覆盖 void Dispose(),我是否需要在子控制器中处理它?
- c# - 如果 admob 广告未加载统一如何加载自定义横幅广告
- android - 我可以使用普通视图作为小部件吗?
- ios - 来自json的tableview部分
- polymer - 准备就绪时聚合物 3 中的淡入过渡
- c++ - 将应用程序与包含另一个库的库链接