1.下载UEditor
下载地址 https://github.com/fex-team/ueditor/releases ,将最新版本1.4.3.3的完整源码和Jsp版本UTF-8版本下载下来并解压。
2.配置pom.xml
项目中配置UEditor的源码需要的jar包
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.11</version>
</dependency>
3.导入UEditor源码及资源文件
将解压的utf8-jsp版本目录下的除jsp目录和index.html文件,其余文件全部导入到resources/static目录下manage/ueditor文件夹中
4,配置JS包
<script src="/manage/ueditor/ueditor.config.js" type="text/javascript" charset="utf-8"></script>
<script src="/manage/ueditor/ueditor.all.js" type="text/javascript" charset="utf-8"></script>
<script src="/manage/ueditor/lang/zh-cn/zh-cn.js" type="text/javascript" charset="utf-8"></script>
5,引用页面如下
<textarea id="detail" name="detail" th:text="${model.detail}" style="height:500px;"></textarea>
<script type="text/javascript">
$(function () {
var ue = UE.getEditor('detail');
});
</script>