一年前写过一篇:struts2 配置 xheditor 的文章。那时候还在用ssh,现在开始用spring boot。本来想配置优快云的markdown编辑器的,可惜在github上找不到。所以,还是用回轻巧的xheditor吧。
环境要求:Spring Boot v1.5.1.RELEASE、jdk1.7、myeclipse2015 、xheditor1.1.14
xheditoe的官网好像下不了,我把xheditor1.1.14的压缩包上传到资源那里了,点击进入xheditor1.1.14的下载页
下面是配置过程:
1).解压xheditor,在static目录下新建一个xheditor目录,将解压的文件通通放进去
2).在 templates 下新建一个html页面:blog.html
这里要注意两点:
<1> pageInit()里面的配置:html5Upload:false ,一定要设置为false,不然无法上传图片;
<2> upImgUrl:”/uploadimg” 的 /uploadimg 是异步上传图片的方法(下点会讲)
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" >
<head>
<meta name="keywords" content="keyword1,keyword2,keyword3"></meta>
<meta name="description" content="this is my page"></meta>
<meta name="content-type" content="text/html; charset=UTF-8"></meta>
<title>博客</title>
<link