(editor) Jquery-easyui Collection Kindeditor Editor

Source: Internet
Author: User

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 ()); });

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.