kindeditor在Ext的使用

在 http://kindeditor.net/ 下载 kindeditor。可以自己查阅 kindeditor的使用说明:http://kindeditor.net/docs/usage.html

下面说说自己的使用:

先看效果:


【1】我下载的的4.1.10版,下载后的文件目录如下:可以根据需求删除以下目录后部署到自己的程序上:http://域名/hcp/kindeditor/ 。

  • asp - ASP程序
  • asp.net - ASP.NET程序
  • php - PHP程序
  • jsp - JSP程序
  • examples - 演示文件


【2】在要使用 kindeditor的HTML网页上添加以下脚本:

<script charset="utf-8" src="/editor/kindeditor.js"></script>
<script charset="utf-8" src="/editor/lang/zh_CN.js"></script>
【3】使用以下方法便可显示:

           {
    	    	xtype: 'textareafield',
                maxLength : '1000',
                maxLengthText : '文章提示信息长度不能超过2000字',
                name : 'desciption',
                fieldLabel:"初始值",//赋初始值
                width :'100%',
                height : 350,
                id : 'desciption',//不能缺少
                listeners : {"render" : function(f) {
                	K = KindEditor;
                	htmlEditor = K.create('#desciption',//对应id
                		{
                			cssPath : 'kindeditor/plugins/code/prettify.css',
                                        uploadJson : 'kindeditor/jsp/upload_json.jsp',//图片上传处理文件,保存图片地址需正确,否则显示:上传目录不存在
                                        fileManagerJson : 'kindeditor/jsp/file_manager_json.jsp',
                                        //fontSizeTable:['21px','20px','17px','18px','16px','14px','12px'],
                                        resizeType : 1,
                                        allowPreviewEmoticons : true,
                                        allowImageUpload : true
                		});
                    }
                }
    	    }

【4】获取内容:

var desciption =htmlEditor.html();

【5】弹出“上传文件不存在” ,可查看 “upload_json.jsp” 文件,并做改善。

将以下内容:

//检查目录
File uploadDir = new File(savePath);
if (!uploadDir.exists()) {
	out.println(getError("上传目录不存在。"));
	return;
}
改为:
File uploadDir = new File(savePath);
if (!uploadDir.exists()) {
	uploadDir.mkdirs();//创建目录
}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值