SpringBoot 配置富文本编辑器 xheditor

本文介绍了如何在Spring Boot v1.5.1.RELEASE环境中配置xheditor,包括创建静态目录、设置html页面、处理图片异步上传的controller以及配置文件上传限制。注意xheditor的html5Upload需设为false,并确保返回的msg包含完整图片路径。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一年前写过一篇: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
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值