Consolidating Kindeditor text box controls in the DWZ framework

Source: Internet
Author: User

This morning in the DWZ framework of the integration of the Kindeditor text box control, found that the upload image is always prompt "on the cross, please wait ...", internet access to see people said it might be a file path problem, in the other project to use this control has been no problem, how can this error?

So from the source to find the past, find upload configuration Uploadjson: '/scripts/kindeditor-4.1.4/asp.net/upload_json.ashx ', so open the upload file Upload_ Json.ashx file, found Context.Response.Write (Jsonmapper.tojson (result)); The Jsonmapper namespace in this sentence could not be found, due to the opening of other previous projects, Only to find that the original less reference a LitJSON.dll file, so this record share to other small partners, if you also integrate Kindeditor control in the DWZ framework, you can follow the following steps:

(1). Refer to the LitJSON.dll file.

(2). Found in the Dwz.ui.js file

 if($.fn.xheditor) {$ ("Textarea.editor", $p). each (function () {var$ This= $( This); varop = {html5upload:false, Skin:'Vista', Tools: $ This. attr ("Tools") ||' Full' }; varUpattrs = [                ["Uplinkurl","Uplinkext","Zip,rar,txt"],                ["Upimgurl","Upimgext","Jpg,jpeg,gif,png"],                ["Upflashurl","Upflashext","SWF"],                ["Upmediaurl","Upmediaext","avi"]            ]; $ (upattrs). Each (function (i) {varUrlattr = upattrs[i][0]; varExtattr = upattrs[i][1]; if($ This. attr (urlattr)) {Op[urlattr]= $ This. attr (urlattr); OP[EXTATTR]= $ This. attr (extattr) | | upattrs[i][2];            }            }); $ This. Xheditor (OP);    }); }

Continue to add the following method below this method

$("Textarea.kindeditor", $p). each (function () {$.getscript ('/scripts/kindeditor-4.1.4/kindeditor-min.js', function () {Kindeditor.basepath='/scripts/kindeditor-4.1.4/'; varEditor1 = Kindeditor.create ('#content', {csspath:'/scripts/kindeditor-4.1.4/plugins/code/prettify.css', Uploadjson:'/scripts/kindeditor-4.1.4/asp.net/upload_json.ashx', Filemanagerjson:'/scripts/kindeditor-4.1.4/asp.net/file_manager_json.ashx', Allowfilemanager:true, items: ['Preview','|','FontName','fontsize','|','ForeColor','Hilitecolor','Bold','Italic','Underline',                            'Removeformat','lineheight','Strikethrough','|','Justifyleft','Justifycenter','Justifyright','insertorderedlist',                            'insertunorderedlist','Indent','outdent','Quickformat','|','Image','HR','Baidumap','Link','|',' About'], aftercreate:function () {varSelf = This; Kindeditor.ctrl (document, -, function () {self.sync (); K ('Form[name=example]')[0].submit ();                    }); Kindeditor.ctrl (Self.edit.doc, -, function () {self.sync (); Kindeditor ('Form[name=example]')[0].submit (); }); Kindeditor ('button[name=gethtml]'). Click (function (e) {document.getElementById ("NEWSCONTENTC"). Value =editor1.html ();                });            }            });        Prettyprint ();    });    }); if($.fn.uploadify) {$ (": File[uploader]", $p). each (function () {var$ This= $( This); varOptions ={uploader: $ This. attr ("Uploader"), script: $ This. attr ("Script"), Cancelimg: $ This. attr ("cancelimg"), Filedataname: $ This. attr ("Filedataname"), Queueid: $ This. attr ("Filequeue") ||"Filequeue", Filedesc: $ This. attr ("Filedesc") ||"*.jpg;*.jpeg;*.gif;*.png;*.pdf", Fileext: $ This. attr ("Fileext") ||"*.jpg;*.jpeg;*.gif;*.png;*.pdf", folder: $ This. attr ("folder"), Auto:true, Multi:true, Onerror:uploadifyerror, OnComplete: $ This. attr ("OnComplete") ||uploadifycomplete, Onallcomplete:uploadifyallcomplete}; if($ This. attr ("OnComplete") ) {Options.oncomplete= Dwz.jsoneval ($ This. attr ("OnComplete")); }            if($ This. attr ("Onallcomplete") ) {Options.onallcomplete= Dwz.jsoneval ($ This. attr ("Onallcomplete")); }            if($ This. attr ("Scriptdata") ) {Options.scriptdata= Dwz.jsoneval ($ This. attr ("Scriptdata")); }            $ This. uploadify (options);    }); }

(3). Add on page

<!--kindeditor Start-up
<link href= "@Url. Content (" ~/scripts/kindeditor-4.1.4/themes/default/default.css ")" rel= "stylesheet" type= "text /css "/>
<link href= "@Url. Content (" ~/scripts/kindeditor-4.1.4/plugins/code/prettify.css ")" rel= "stylesheet" type= "text/ CSS "/>

<script src= "@Url. Content (" ~/scripts/kindeditor-4.1.4/kindeditor.js ")" Type= "Text/javascript" ></script >
<script src= "@Url. Content (" ~/scripts/kindeditor-4.1.4/lang/zh_cn.js ")" Type= "Text/javascript" ></script >
<script src= "@Url. Content (" ~/scripts/kindeditor-4.1.4/plugins/code/prettify.js ")" Type= "Text/javascript" > </script>
<!--kindeditor Start-up

(4). In the page Fit location add

<textarea id= "Content" name= "Content" tools= "basic" style= "width:680px; height:200px; "class=" Kindeditor ">
</textarea>

Alternatively, you can define a public variable that configures the parameters in the Kindeditor configuration on the page.

<script type="text/javascript">    var GV = {}    ' /scripts/kindeditor-4.1.4/ ' ' /scripts/kindeditor-4.1.4/asp.net/upload_json.ashx ' ' /scripts/kindeditor-4.1.4/asp.net/file_manager_json.ashx '  }; </script>

Consolidating Kindeditor text box controls in the DWZ framework

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.