今天上午在DWZ框架中整合kindeditor复文本框控件,发现上传图片是老是提示 “上传中,请稍候...”,上网查看别人说可能是文件路径问题,在想以前在其他项目中用这个控件一直没问题,到这里怎么会出现这个错误呢?

于是从源头一路查找过去, 找到上传配置 uploadJson: '/Scripts/kindeditor-4.1.4/asp.net/upload_json.ashx',于是打开上传文件的upload_json.ashx文件,发现context.Response.Write(JsonMapper.ToJson(result));这句中的JsonMapper命名空间找不到,由于打开以前其他项目,才发现原来少引用一个LitJSON.dll文件,所以在此记录一下分享给其他小伙伴,如果你也在DWZ框架中整合kindeditor控件的话,可按下面步骤进行:

(1).引用LitJSON.dll文件.

(2).在 dwz.ui.js文件中找到

 if ($.fn.xheditor) {
$("textarea.editor", $p).each(function () {
var $this = $(this);
var op = { html5Upload: false, skin: 'vista', tools: $this.attr("tools") || 'full' };
var upAttrs = [
["upLinkUrl", "upLinkExt", "zip,rar,txt"],
["upImgUrl", "upImgExt", "jpg,jpeg,gif,png"],
["upFlashUrl", "upFlashExt", "swf"],
["upMediaUrl", "upMediaExt", "avi"]
]; $(upAttrs).each(function (i) {
var urlAttr = upAttrs[i][];
var extAttr = upAttrs[i][]; if ($this.attr(urlAttr)) {
op[urlAttr] = $this.attr(urlAttr);
op[extAttr] = $this.attr(extAttr) || upAttrs[i][];
}
}); $this.xheditor(op);
});
}

在这个方法下面继续添加下面方法

 $("textarea.kindeditor", $p).each(function () {
$.getScript('/Scripts/kindeditor-4.1.4/kindeditor-min.js', function () {
KindEditor.basePath = '/Scripts/kindeditor-4.1.4/';
var editor1 = 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 () {
var self = this;
KindEditor.ctrl(document, , function () {
self.sync();
K('form[name=example]')[].submit();
});
KindEditor.ctrl(self.edit.doc, , function () {
self.sync();
KindEditor('form[name=example]')[].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);
var options = {
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).在页面上添加

<!--kindeditor 开始-->
<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 开始-->

(4).在页面适合位置添加

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

另外,也可以定义一个公共变量,把kindeditor 配置中参数在页面上进行配置。

<script type="text/javascript">
var GV = {}
GV.kindeditor = { basePath: '/Scripts/kindeditor-4.1.4/', upload: '/Scripts/kindeditor-4.1.4/asp.net/upload_json.ashx', filemanager: '/Scripts/kindeditor-4.1.4/asp.net/file_manager_json.ashx' };
</script>

在DWZ框架中整合kindeditor复文本框控件的更多相关文章

  1. 【案例分享】在 React 框架中使用 SpreadJS 纯前端表格控件

    [案例分享]在 React 框架中使用 SpreadJS 纯前端表格控件 本期葡萄城公开课,将由国电联合动力技术有限公司,资深前端开发工程师——李林慧女士,与大家在线分享“在 React 框架中使用 ...

  2. IOS中UITextView(多行文本框)控件的简单用法

    1.创建并初始化 UITextView文本视图相比与UITextField直观的区别就是UITextView可以输入多行文字并且可以滚动显示浏览全文.UITextField的用处多,UITextVie ...

  3. C#开发微信门户及应用(48) - 在微信框架中整合CacheManager 缓存框架

    在我们的很多框架或者项目应用中,缓存在一定程度上可以提高程序的响应速度,以及减轻服务器的承载压力,因此在一些地方我们都考虑引入缓存模块,这篇随笔介绍使用开源缓存框架CacheManager来实现数据的 ...

  4. [转载]在网页中插入media,RealPlayer等控件

    [转载]在网页中插入media,RealPlayer等控件 (2012-11-02 20:27:43) 转载▼ 标签: 转载   原文地址:在网页中插入media,RealPlayer等控件作者:Mo ...

  5. jQuery学习笔记(在js中增加、删除及定位控件的操作)

    代码内容很多都是从amazeui直接copy过来的,先声明,请不要说在下抄袭- - <!-------------------- HTML代码 ----------------------> ...

  6. iOS中如何让TextView和TextField控件支持return键收起输入法

    TextView和TextField控件是iOS中负责接收用户输入的控件,那当用户输入完成时怎么收起面板呢? 1.TextView和TextField控件获得焦点之后的第一反应就是弹出输入法面板: 2 ...

  7. 在2015中使用V12版本的ReportView控件,会导致winform窗体不能正常打开

    在2015中使用V12版本的ReportView控件,会导致winform窗体不能正常打开,使用V10版本没问题,但2015中默认使用的就是V12版本,所以需要避免使用V12版本

  8. JS 获取某个容器控件中id包含制定字符串的控件id列表

    //获取某容器控件中id包含某字符串的控件id列表 //参数:容器控件.要查找的控件的id关键字 function GetIdListBySubKey(container,subIdKey) { va ...

  9. C#中禁止跨线程直接访问控件

    C#中禁止跨线程直接访问控件,InvokeRequired是为了解决这个问题而产生的,当一个控件的InvokeRequired属性值为真时,说明有一个创建它以外的线程想访问它.此时它将会在内部调用ne ...

随机推荐

  1. php yii框架使用MongoDb

    1.安装 运行 php composer.phar require --prefer-dist yiisoft/yii2-mongodb or add "yiisoft/yii2-mongo ...

  2. RPi 2B Documentation

    /********************************************************************** * RPi 2B Documentation * 声明: ...

  3. ES PES TS

    1.流媒体系统结构 ES:elemental stream 基本数据流: PES:packet elemental stream分组的基本数据流: 然后把PES打包成PS ,TS流,PS:progra ...

  4. 视频捕捉全教程(vc+vfw)

    目 录 一. 视频捕获快速入门 二.基本的捕获设置 1.设置捕获速度: 2.设置终止捕获 3.捕获的时间限制 三.关于捕获窗口 1.创建一个AVICAP捕获窗口 2.将一个捕获窗口连接至捕获设备 3. ...

  5. windows下MySql没有setup.exe时的安装方法

    01.把 mysql-advanced-5.6.17-winx64.zip 解压到自定义 D:\mysql-5.6.17-W64 或 D:\mysql-advanced-5.6.17-winx64 目 ...

  6. HDU 1387 Team Queue

    Team Queue Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  7. HDU 4405-Aeroplane chess(概率dp)

    题意: n+1格飞行棋,编号0-n,从0格开始,每次扔一个色子,得到的点数就向前走几步,但有有些格子到达后可以直接飞到后面的格子, 当到达>=n的地方结束,求结束扔色子的期望次数. 分析: dp ...

  8. VC++6.0 MFC播放视频

    注:需要在windows xp下才可以使用Windows Media Player插件,在windows 7下面会找不到该插件. 1.Windows Media Player控件的主要方法: 1)Ge ...

  9. net中前台javascript与后台c#函数相互调用

    问: 1.如何在JavaScript访问C#函数? 2.如何在JavaScript访问C#变量? 3.如何在C#中访问JavaScript的已有变量? 4.如何在C#中访问JavaScript函数? ...

  10. QT4.7.4-vs2008和vs2010的安装并编写测试程序

    QT的安装着实费了我好大的劲,之前试过QT5.1.0与VS2010的安装,但是因为设置的地方太多,程序运行总是不成功,所以最后选用QT4.7.4和VS2008与VS2010来编写程序.写这篇文章来总结 ...