具体方法
本人使用 的是@version 4.1.2 现在应该有更新了KindEditor 4.1.4 已经发布
KindEditor主要特点
快速:体积小,加载速度快
开源:开放源代码,高水平,高品质
底层:内置自定义 DOM 类库,精确操作 DOM
扩展:基于插件的设计,所有功能都是插件,可根据需求增减功能
风格:修改编辑器风格非常容易,只需修改一个 CSS 文件
兼容:支持大部分主流浏览器,比如 IE、Firefox、Safari、Chrome、Opera
下面说一下kindeditor在thinkphp中的使用
步骤1:下载kindeditor编辑器http://www.kindsoft.net/
步骤2:文件引入
代码如下
<script charset="utf-8" src="__PUBLIC__/kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="__PUBLIC__/kindeditor/lang/zh_CN.js"></script>
步骤3:配置参数
代码如下<script>
KindEditor.ready(function(K) {
var editor1 = K.create("textarea[name="content"]", {
cssPath : "__PUBLIC__/kindeditor/plugins/code/prettify.css",
uploadJson : "__PUBLIC__/kindeditor/php/upload_json.php",
fileManagerJson : "__PUBLIC__/kindeditor/php/file_manager_json.php",
allowFileManager : true,
afterCreate : function() {
var self = this;
K.ctrl(document, 13, function() {
self.sync();
K("form[name=example]")[0].submit();
});
K.ctrl(self.edit.doc, 13, function() {
self.sync();
K("form[name=example]")[0].submit();
});
}
});
prettyPrint();
});
</script>
textarea 中的content和上面 红色的content对应
kindeditor html代码过滤不能保存
这是因为编辑器默认开启了过滤模式(filterMode:true)。当filterMode为true时,编辑器会根据htmlTags设定自动过滤HTML代码,主要是为了生成干净的代码。
如果想保留所有HTML,修改kindeditor.js,请将filterMode设置成false。如果想保留特定HTML,请将filterMode设置成true后,配置htmlTags属性。
thinkphp整合kindeditor编辑器_thinkphp整合kindeditor编辑器详解
http://m.bbyears.com/jiaocheng/40956.html
推荐访问: