UEditor的使用

1.官网http://ueditor.baidu.com/website/download.html下载使用jsp,utf-8版本
2.解压缩至我的springBoot项目static中相对路径为/resources/static/plugins/ueditor/jsp/config.json
3.创建一个控制类去指向配置文件

@Controller
public class UeditorController {
    @RequestMapping("/config")
    public String config(String action, HttpServletRequest request, HttpServletResponse response) {
        return "redirect:/plugins/ueditor/jsp/config.json";
    }
}

4.修改/resources/static/plugins/ueditor/ueditor.config.js中的服务器统一请求接口路径指向

 /**
     * 配置项主体。注意,此处所有涉及到路径的配置别遗漏URL变量。
     */
    window.UEDITOR_CONFIG = {

        //为编辑器实例添加一个路径,这个不能被注释
        UEDITOR_HOME_URL: URL

        // 服务器统一请求接口路径
        , serverUrl: URL + "/config" //修改为刚才controller里的路径

5.简单上传文件路径修改
resources/static/plugins/ueditor/ueditor.all.js
simpleupload

 var imageActionUrl = projectName+"/ueditor/upload";

6.多图片上传
/resources/static/plugins/ueditor/dialogs/image/image.js

  actionUrl=projectName+"/ueditor/upload";

7.附件上传
/resources/static/plugins/ueditor/dialogs/attachment/attachment.js

 actionUrl=projectName+"/ueditor/upload";

8.关于projectName

var pathName = window.document.location.pathname;
var projectName = pathName.substring(0, pathName.substr(1).indexOf('/')+1);
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容