步骤1:下载kindeditor编辑器http://www.kindsoft.net/
步骤2:文件引入
 
步骤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 name="content" style="width:700px;height:200px;visibility:hidden;"></textarea>
 
textarea 中的content和上面 红色的content对应
特别提示:kindeditor html代码过滤。
kindeditor html代码过滤不能保存
这是因为编辑器默认开启了过滤模式(filterMode:true)。
当filterMode为true时,编辑器会根据htmlTags设定自动过滤HTML代码,主要是为了生成干净的代码。
如果想保留所有HTML,修改kindeditor.js,请将filterMode设置成false。
如果想保留特定HTML,请将filterMode设置成true后,配置htmlTags属性。
通过以上三个步骤,便可实现在thinkphp中配置编辑器kindeditor了,如今的网页在线编辑器,可真是百花齐放,建议大家在日常的编程开发中,选定一个适合自己的,好好琢磨下。