Springboot零配置集成UEditor

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

          

        2.pom文件引入

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

    3. Springboot application.yml配置(可选配置)

  2. ue:
      root-path: classpath:/static #文件存储根目录(可选配置),默认为[classpath:/static]
      server-url: /ueditor/jsp/controller #服务器统一请求接口路径(可选配置),默认为[/ueditor/jsp/controller]
      upload: cn.jasonone.ueditor.upload.LocationFileStorage #文件持久化处理类(可选配置),默认为[cn.jasonone.ueditor.upload.LocationFileStorage]

         4.UEditor配置(必选)

  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>

猜你喜欢

转载自blog.csdn.net/xujie784442670/article/details/84533380