下载地址 :/wangfupeng1988/wangEditor/releases
1.用script标签引入wangEditor.js
2.初始化编辑器 代码如下
<div id = "commentDiv"></div>
//编辑器
var E = window.wangEditor;
var commentDiv = new E(#commentDiv);
//开启本地上传图片选项
commentDiv.customConfig.uploadImgServer = ${ctx}/WangUpload; //上传URL
commentDiv.customConfig.uploadImgMaxSize = 2 * 1024 * 1024;
commentDiv.customConfig.uploadImgMaxLength = 5;
commentDiv.customConfig.uploadFileName = myFileName;
commentDiv.customConfig.uploadImgHooks = {
customInsert: function (insertImg, result, editor) {
// 图片上传并返回结果,自定义插入图片的事件(而不是编辑器自动插入图片!&