1. Add in HTML
List.html
List.html(function($, K) {if(! K)Throw"Kindeditor not defined!"; functionCreate (target) {varopts = $.data (target,' Kindeditor '). Options; vareditor = k.create (target, opts); $.data (Target,' Kindeditor '). options.editor = editor; } $.fn.kindeditor =function(options, param) {off(typeofoptions = =' String ') { varmethod = $.fn.kindeditor.methods[options]; if(method) {returnMethod ( This, param); }} options = Options | | {}; return This. each (function() { varstate = $.data ( This, ' Kindeditor '); if(state) {$.extend (state.options, Options); } Else{state = $.data ( This, ' Kindeditor ', {options: $.extend ({}, $.fn.kindeditor.defaults, $.fn.kindeditor.parseoptions ( This), Options)}); } Create ( This); }); } $.fn.kindeditor.parseoptions =function(target) {return$.extend ({}, $.parser.parseoptions (target, [])); }; $.fn.kindeditor.methods = {Editor:function(JQ) {return$.data (jq[0],' Kindeditor '). Options.editor; } }; $.fn.kindeditor.defaults = {resizetype:1, allowpreviewemoticons:false, Allowimageupload:false, items: [' FontName ', ' FontSize ', ' | ', ' ForeColor ', ' Hilitecolor ', ' Bold ', ' Italic ', ' underline ', ' Removeformat ', ' | ', ' Justifyleft ', ' Justifycenter ', ' Justifyright ', ' Insertorderedlist ', ' Insertunorderedlist ', ' | ', ' Emoticons ', ' image ', ' link '], AfterChange:function() { This. sync (); }, Afterblur:function() { This. sync ();} }; $.parser.plugins.push ("Kindeditor"); }) (JQuery, kindeditor);
2. You need to reference both Easyui and Kindeditor related styles and scripts, and then you can use Kindeditor as you would with Easyui components:
<Linkhref= "Kindeditor-4.1.10/examples/index.css"rel= "stylesheet"/> <Scriptsrc= "Kindeditor-4.1.10/kindeditor.js" ></Script> <Scriptsrc= "Kindeditor-4.1.10/kindeditor-all.js" ></Script> <Scriptsrc= "Kindeditor-4.1.10/kindeditor-all-min.js" ></Script> <Scriptsrc= "Kindeditor-4.1.10/kindeditor-min.js" ></Script> <Scriptsrc= "Kindeditor-4.1.10/lang/zh_cn.js" ></Script>
Call Method:
<textareaname= "Easyui_ditor"ID= "Easyui_ditor"class= "Easyui-kindeditor"style="width: 90%; Height: 140px; Visibility: Hidden;">Kindeditor</textarea>
3.360 Browser is not compatible, Firefox browser is normal, so the assignment method
Ke.html (ID, Val)
Sets the HTML content of the editor.
Parameters:
Id:string, Editor's ID
val:string,html string
return value: None
The page has only one editor so the latest version can be written like this.
kindeditor.html (' #txtIntroduce ', data. introduce);
Loadfilter:function(data) {$.post (".. /action/newslist.ashx ", {content: $ (' #easyui_ditor '). Val ()},function(data) {varjson = eval ("(" + data +")"); //alert (Json.news[0]. Content)//$ (' #easyui_ditor '). Val (Json.news[0]. Content); kindeditor.html ($ (' #easyui_ditor '), Json.news[0]. Content); //console.info ($ (' #easyui_ditor '). Val ()); });