在DWZ框架中整合kindeditor复文本框控件
今天上午在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复文本框控件的更多相关文章
- 【案例分享】在 React 框架中使用 SpreadJS 纯前端表格控件
[案例分享]在 React 框架中使用 SpreadJS 纯前端表格控件 本期葡萄城公开课,将由国电联合动力技术有限公司,资深前端开发工程师——李林慧女士,与大家在线分享“在 React 框架中使用 ...
- IOS中UITextView(多行文本框)控件的简单用法
1.创建并初始化 UITextView文本视图相比与UITextField直观的区别就是UITextView可以输入多行文字并且可以滚动显示浏览全文.UITextField的用处多,UITextVie ...
- C#开发微信门户及应用(48) - 在微信框架中整合CacheManager 缓存框架
在我们的很多框架或者项目应用中,缓存在一定程度上可以提高程序的响应速度,以及减轻服务器的承载压力,因此在一些地方我们都考虑引入缓存模块,这篇随笔介绍使用开源缓存框架CacheManager来实现数据的 ...
- [转载]在网页中插入media,RealPlayer等控件
[转载]在网页中插入media,RealPlayer等控件 (2012-11-02 20:27:43) 转载▼ 标签: 转载 原文地址:在网页中插入media,RealPlayer等控件作者:Mo ...
- jQuery学习笔记(在js中增加、删除及定位控件的操作)
代码内容很多都是从amazeui直接copy过来的,先声明,请不要说在下抄袭- - <!-------------------- HTML代码 ----------------------> ...
- iOS中如何让TextView和TextField控件支持return键收起输入法
TextView和TextField控件是iOS中负责接收用户输入的控件,那当用户输入完成时怎么收起面板呢? 1.TextView和TextField控件获得焦点之后的第一反应就是弹出输入法面板: 2 ...
- 在2015中使用V12版本的ReportView控件,会导致winform窗体不能正常打开
在2015中使用V12版本的ReportView控件,会导致winform窗体不能正常打开,使用V10版本没问题,但2015中默认使用的就是V12版本,所以需要避免使用V12版本
- JS 获取某个容器控件中id包含制定字符串的控件id列表
//获取某容器控件中id包含某字符串的控件id列表 //参数:容器控件.要查找的控件的id关键字 function GetIdListBySubKey(container,subIdKey) { va ...
- C#中禁止跨线程直接访问控件
C#中禁止跨线程直接访问控件,InvokeRequired是为了解决这个问题而产生的,当一个控件的InvokeRequired属性值为真时,说明有一个创建它以外的线程想访问它.此时它将会在内部调用ne ...
随机推荐
- Linux中 干掉原来的PHP方法
干掉原来的PHP方法: 查看php版本命令:#php -v这个命令是删除不干净的#yum remove php因为使用这个命令以后再用#php -v还是会看到有版本信息的..... 必须强制删除#rp ...
- php.ini配置中文详解
;;;;;;;;;;; ; 警告 ; ;;;;;;;;;;; ; 此配置文件是对于新安装的PHP的默认设置. ; 默认情况下,PHP使用此配置文件安装 ; 此配置针对开发目的,并且*不是*针对生产环境 ...
- noip2001提高组题解
今天继续感动滚粗.第一次提交170分,不能多说. 第一题:一元三次方程 明明是寒假讲分治的时候做过的题居然还是WA而且只拿了60分,说明知识掌握实在不够牢固. 寒假做的是保留4位小数,原题只保留2位, ...
- ajax请求总是不成功?浏览器的同源策略和跨域问题详解
场景 码农小明要做一个展示业务数据的大屏给老板看,里面包含了来自自己网站的数据和来自隔壁老王的数据.那么自己网站的数据提供了 http://xiaoming.com/whoami 这样的数据接口隔壁老 ...
- 兼容个个浏览器Cookie的读写
function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split('; ...
- 常用sql命令
--1) 创建一张学生表,包含以下信息,学号,姓名,年龄,性别,家庭住址,联系电话 CREATE TABLE student ( [id] [int] IDENTITY(1,1) NOT NU ...
- DIV+CSS常见问题:DIV如何设置一个像素高度?
CSS如何控制DIV实现1像素高度呢?问题看起来很简单,但万恶的IE6会让你很麻烦,不过解决办法很多,本文将介绍最简单的一种:DIV{height:1px;line-height:1px;font-s ...
- 利用原生JavaScript获取样式的方式小结
来源:http://www.ido321.com/930.html ps:是获取样式,不是设置样式.若没有给元素设置样式值,则返回浏览器给予的默认值.(论坛整理) 1.element.style:只能 ...
- DRAM 内存介绍(一)
转载自博客大神迈克老狼的blog: http://www.cnblogs.com/mikewolf2002/archive/2012/11/13/2768804.html 参考资料:http://ww ...
- <Chapter 2>2-2.开发应用(developing the Application)
一个App Engine应用对网络请求做出响应.它是通过调用请求处理器(quest handlers)来实现的,接受请求参数并返回响应的程序.对于来自请求URL上的请求,App Engine通过一个配 ...