今天上午在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. [反汇编练习]160个CrackMe之001

    [反汇编练习] 160个CrackMe之001. 本系列文章的目的是从一个没有任何经验的新手的角度(其实就是我自己),一步步尝试将160个CrackMe全部破解,如果可以,通过任何方式写出一个类似于注 ...

  2. buildroot linux filesystem 初探

    /****************************************************************************** * buildroot linux fi ...

  3. ASP.NET CORE Web浏览器和Web服务器

    //web浏览器 //浏览器本质的原理:浏览器向服务器发请求,服务器把请求的内容返回给浏览器,然后浏览器把返回的内容绘制成一个图形化的界面 //Socket一种通讯交流的技术 //qq用户把信息通过s ...

  4. Linux 中直接 I/O 机制的介绍

    https://www.ibm.com/developerworks/cn/linux/l-cn-directio/ 对于传统的操作系统来说,普通的 I/O 操作一般会被内核缓存,这种 I/O 被称作 ...

  5. hdu 3172 Virtual Friends(并查集)University of Waterloo Local Contest 2008.09

    题目比较简单,但作为长久不写题之后的热身题还是不错的. 统计每组朋友的朋友圈的大小. 如果a和b是朋友,这个朋友圈的大小为2,如果b和c也是朋友,那么a和c也是朋友,此时这个朋友圈的大小为3. 输入t ...

  6. Android常用控件之FragmentTabHost的使用

    最近在学TabHost时发现TabActivity在API level 13以后不用了,所以就去寻找它的替换类,找到FragmentActivity,可以把每个Fragment作为子tab添加到Fra ...

  7. POJ 2096-Collecting Bugs(概率dp入门)

    题意: 有n种bug和s种系统bug,每天发现一种bug(可能已经发现过了)所有种bug被发现的概率相同,求所有bug被发现的期望天数. 分析: dp[i][j]发现i种bug,j种系统bug期望天数 ...

  8. maven学习系列第二课,关于springmvc的pop.xml的依赖的添加

    不说废话了,图的书序就是操作顺序 1. 2.

  9. oracle检查点checkpoint信息

    1.关于checkpoint的概述 checkpoint是oracle在数据库一致性关闭.实例恢复和oracle基本操作中不可缺少的机制,包含以下相关的含义: A.检查点的位置(checkpoint ...

  10. Javascript——说说js的调试

    最近比较吐槽,大家都知道,现在web前端相对几年前来说已经变得很重了,各种js框架,各种面对对象,而且项目多了,就会提取公共模块. 这些模块的UI展示都一样,不一样的就是后台逻辑,举个例子吧,我们做企 ...