KindEditor编辑框的内容上传

来源:互联网 发布:黑马校对软件好用吗 编辑:程序博客网 时间:2024/05/18 00:39

参考KindEditor的官方提供文档:

1.界面

<textarea id="content" name="content" style="width: 185px; height: 100px;">${content}</textarea>


2.javascript,可以根据自己的项目进行修改cssPath、uploadJson、fileManagerJson的路径。

<script type="text/javascript">
$(function() {
var editor3 = KindEditor.create('textarea[name="content"]', {
resizeType : 1,
allowPreviewEmoticons : false,
allowImageRemote : false,
filterMode : false,
cssPath : '${ctx}/rel/js/kindeditor/plugins/code/prettify.css',
uploadJson : '${ctx}/rel/js/kindeditor/jsp/upload_json.jsp',
fileManagerJson : '${ctx}/rel/js/kindeditor/jsp/file_manager_json.jsp',
allowFileManager : true,
afterBlur : function() {
this.sync();
},
items : [
        'source','fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
        'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
        'insertunorderedlist', 'image', 'multiimage','link','unlink']
});


});
</script>


3.copy lib文件夹中带的jar包到项目中



4. 按需求修改上面的upload_json.jsp和file_manager_json.jsp这两个文件的Java脚本代码即可。(也可以把其中的Java代码使用到java文件中使用)

0 0
原创粉丝点击