springboot整合百度ueditor编辑器

1.到ueditor编辑器官网下载
https://ueditor.baidu.com/website/download.html
在这里插入图片描述
2.下载解压后复制到当前项目
在这里插入图片描述
3.导入maven依赖

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

4.application.properties文件添加依赖

ue.root-path=classpath:/static
ue.server-url=/ueditor/jsp/controller

5.修改ueditor.config.js配置文件路径,需要与上面配置一致
在这里插入图片描述
6.在使用的html界面导入相关js初始化编辑器

<html>
<head>
<title>完整demo</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="ueditor/lang/zh-cn/zh-cn.js"></script>


</head>
<body>
	<script id="editor" type="text/plain" style="width:100%;height:500px;"></script>
	<script type="text/javascript">
		UE.getEditor('editor');
	</script>

</body>
</html>

7.启动类添加注解

在这里插入图片描述
测试上传成功
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_44315761/article/details/107371362
今日推荐