- 博客(0)
- 资源 (2)
空空如也
kindEditor中关于上传处理
最近由于项目需要,在Ext中用到了kindEditor。
具体总结如下,希望对还在研究中的朋友有所帮助。
首先,需要在kindEditor官网上下载4.0版本的包(注意,版本一定要是4.0)。
具体地址如下:http://code.google.com/p/kindeditor/downloads/list
具体用在ExtJs中的用法如下
1)对应的JSP需要引入
<link rel=”stylesheet” href=”${pageContext.request.contextPath}/common/kingeditor/themes/default/default.css”/>
<link rel=”stylesheet” href=”${pageContext.request.contextPath}/common/kingeditor/plugins/code/prettify.css”/>
[removed][removed]
[removed][removed]
[removed][removed]
其中 ${pageContext.request.contextPath}/common/kingeditor为我在项目中放置kindeditor的目录。
(2)对应的JS
1.声明一个全局的变量
var content;
2. 声明一个Ext文本域控件,文本域控件嵌入kindEditor
var kindEditor_are = new Ext.form.TextArea({
id: 'infoContent',
name: 'infoContent',
listeners: {
"render": function (f) {
content = KindEditor.create('#infoContent', {
uploadJson :rootPath + '/common/kingeditor/jsp/upload_json.jsp?id=' + infoOrgFuncId,
fileManagerJson :rootPath + '/common/kingeditor/jsp/file_manager_json.jsp',
allowFileManager : false,
height: 380,
width: 775
});
}
}
});
3)页面保存的时候需要调用:
kindEditor_are.setValue(content.html());
4)页面修改的时候调用
在form.load里加入以下代码:
var contentValue = document.getElementById('infoContent').value;
content.html(contentValue);
另外,kindEditor的上传功能官方给的在实际项目中有点差别。需要修改下.
2011-12-29
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人