在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 ...
随机推荐
- Web Api 中使用 PCM TO WAV 的语音操作
/// <summary> /// 语音[文件.上传.解码.保存(WAV)] /// </summary> [DeveloperEx("Liwei:秘书语音需求单&q ...
- 苹果官方 Crash文件分析方法 (iOS系统Crash文件分析方法)
对于提交的苹果官方的app,在审核的时候会给我们一些crash文件,对于这些有用的文件,里面是关于我们的bug的一些信息,那么该如何去调试呢 第一步:在任意目录创建一个目录,用来调试crash,我这里 ...
- RESTful API 设计最佳实践(转)
背景 目前互联网上充斥着大量的关于RESTful API(为方便,下文中“RESTful API ”简写为“API”)如何设计的文章,然而却没有一个”万能“的设计标准:如何鉴权?API 格式如何?你的 ...
- 【Servlet】doGet()与doPost()的区别
doGet与doPost的区别 .Servlet接口只定义了一个服务方法--service .当发出客户端请求时,调用service方法并传递一个请求和响应对象 .使用时经常在doPost()中调用d ...
- jQuery 制作的Tab标签切换选项卡
基于jQuery实现的一个选项卡效果,重点体现在HTML里没有内联事件处理程序,而是定义在js文件里,做到行为与结构的分离.在实际应用过程中,只要保证选项卡模块结构代码的完整性,就可以任意添加N个同类 ...
- WebView介绍
本文主要对WebView进行介绍,包括webView 4个可以定制的点.设置WebView back键响应.控制网页的链接仍在webView中跳转.显示页面加载进度.处理https请求.利用addJa ...
- Delphi读取Word
Delphi读取Word现在关于往Word中写入数据的方法比较多,现在专门开个贴子,希望大家把自己读取Word内容的心得体会说一下,包括读取word文档中,有几个段落,如何读取第几个段落,读取有拼音的 ...
- Xamarin Mono Android Ios 安装、破解(4.12)
一.Windows下面的安装 1. 安装环境介绍: Win8.1 企业版64位.VS2013,mono-android-4.12.02001,下面的安装过程都是在VS2013已经安装成功之后的操作,本 ...
- Twenty Questions
题意: 有n个长度为m的二进制串,每个都是不同的. 为了把所有字符串区分开,你可以询问,每次可以问某位上是0还是1. 问最少提问次数,可以把所有字符串区分开来. 分析: dp[s1][s2]: 表示提 ...
- python测试基于websocket协议的即时通讯接口
随着html5的广泛应用,基于websocket协议的即时通讯有了越来越多的使用场景,本文使用python中的websocket-client模块来做相关的接口测试 import webclient ...