Spring Boot整合UEditor不修改源码

  1.创建Springboot项目,目录结构如下

          

  2.pom文件引入

  1. <dependency>
        <groupId>cn.jasonone.ueditor</groupId>
    	<artifactId>ueditor-spring-boot-starter</artifactId>
    	<version>1.2.2</version>
    </dependency>

     

3. Springboot 配置

  1. Java配置(必选)

    @SpringBootApplication
    @EnableUeditor //启用Ueditor
    //@EnableUeditor(LocationFileStorage.class) //启用Ueditor并指定文件持久化类
    public class UeditorSpringBootExampleApplication {
    
    	public static void main(String[] args) {
    		SpringApplication.run(UeditorSpringBootExampleApplication.class, args);
    	}
    }

     

  2. application.yml配置(可选)

    ue:
      root-path: classpath:/static #文件存储根目录(可选配置),默认为[classpath:/static]
      server-url: /ueditor/jsp/controller #服务器统一请求接口路径(可选配置),默认为[/ueditor/jsp/controller]

     注意: config.json 文件位置默认为server-url的上级目录,如server-url=/ueditor/jsp/controller 则config.json文件应该存放于 ${root-path}/ueditor/jsp/config.json

 4.UEditor配置(必选)

  • static/ueditor/ueditor.config.js 将serverUrl 改为application.yml 中ue.server-url 的值
  1. //...
    //服务器统一请求接口路径
    , serverUrl: URL + "jsp/controller"
    //...

 5.HTML代码(index.html)

  1. <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    	<script type="text/plain" id="editor"></script>
    	<script th:src="@{/ueditor/ueditor.config.js}"></script>
    	<script th:src="@{/ueditor/ueditor.all.js}"></script>
    	<script th:src="@{/ueditor/lang/zh-cn/zh-cn.js}"></script>
    	<script>
    		UE.getEditor('editor');
    	</script>
    </body>
    </html>

版本历史

  • 1.1.3
  1. 修复自定义文件持久化对象不生效问题#IXCR4
  2. 修复错误:Unable to read meta-data for class
  • 1.2.0
  1. 使用全新的持久化接口(cn.jasonone.upload.UeditorStorate)代替cn.jasonone.upload.UeditorUpload接口
  2. 简化自定义持久化接口的定义
  3. 修改启用方式为使用@EnableUeditor注解启用
  4. 修复缺少配置文件时无提示问题#I12KGP
  5. 自定义文件持久化对象配置方式变更为注解设置

 

  • 1.2.2 
  1. 修复使用默认rootPath配置报错的问题 #I1GO02 

项目地址:https://gitee.com/hmjasonone/ueditor-spring-boot-stater

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 13
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值