博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
UEditor 1.2.5 for java 自定义配置
阅读量:5846 次
发布时间:2019-06-19

本文共 2288 字,大约阅读时间需要 7 分钟。

1、自定义工具栏

editor_config.js文件中,找到,toolbars:…并修改,:

,toolbars:[["source","preview","fullscreen","print","searchreplace", "|", "undo","redo", "|",			"removeformat","formatmatch","autotypeset","blockquote","pasteplain","|",            "unlink","link","anchor","spechars","separate","horizontal","insertunorderedlist","insertorderedlist","|",             "rowspacingbottom","rowspacingtop","lineheight","justifyleft","justifycenter","justifyright","justifyjustify","indent", "|",             "bold","italic","underline","strikethrough","superscript","subscript","forecolor","backcolor","paragraph","fontfamily","fontsize", "|",             "inserttable","deletetable","mergeright","mergedown","splittorows","splittocols","splittocells","mergecells","insertcol","insertrow","deletecol","deleterow","insertparagraphbeforetable", "|",             "insertimage","music","emotion","insertvideo","attachment","wordimage","map","gmap","insertframe","date","time"]]

工具之间使用的”|”表示普通分隔,如果强制换行则使用[]把工具括住

2、减少用户管理图片的功能(很多应用都有这个需求,只希望用户上传图片,并不希望他们可以看到其他图片的信息,因此我们需要隐藏红圈部分)

打开项目中的ueditor/dialogs/image/image.html,找到<span tabSrc="imgManager" 和

<span tabSrc="imgSearch"  还有 <div class="saveDir"  3个元素,都加上style=”display:none;”样式,把上述3个部分隐藏掉.

3、修改默认的图片和文件上传路径

Ueditor默认的图片和文件上传路径为/webname/ueditor/jsp/upload下

如果需要修改图片和文件的上传路径,不但需要修改editor_config.js配置文件,还要修改Uploader.java(某些情况还需要修改/webname/ueditor/jsp/下的imageUp.jsp和fileUp.jsp,具体根据需要而定)

例:在项目myDemo中,把默认图片的上传路径改为:/myDemo/userfiles/upload/images, 把文件上传路径改为:/myDemo/userfiles/upload/attachment

1) 修改editor_config.js配置文件,把imagePath, filePath, imageManagerPath 从原来的URL + “jsp/”都修改为”/myDemo/”。

2) 修改Uploader.java中的getPhysicalPath()方法,返回与editor_config.js中imagePath, filePath, imageManagerPath一样的值。修改后代码如下:

private String getPhysicalPath(String path) {	//String servletPath = this.request.getServletPath();	//String realPath = this.request.getSession().getServletContext().getRealPath(servletPath);	//return new File(realPath).getParent() +"/" +path;	return this.request.getSession().getServletContext().getRealPath("/") + "/" + path;}
3) 修改jsp文件夹中的imageUp.jsp文件,把up.setSavePath("upload ");改为up.setSavePath("userfiles/upload/images");
修改fileUp.jsp文件,把up.setSavePath("upload ");改为up.setSavePath("userfiles/upload/attachment");

.

转载于:https://my.oschina.net/tarark/blog/119284

你可能感兴趣的文章
分布式文件系统之MogileFS实现
查看>>
工作之命令小总结(7):tail命令
查看>>
LVS+keepalived负载均衡
查看>>
Android下获取状态栏的高度
查看>>
Start Developing iOS Apps Today系列(六)
查看>>
UITableview中cell重用引起的内容重复的问题
查看>>
stm32 ADC使用 单通道 多通道
查看>>
UVA 10003 Cutting Sticks
查看>>
DRP项目总结
查看>>
图的连通性——无向图的连通分量和生成树
查看>>
VM10.0上创建Windows server 2008 SP2,并且,安装loadrunner11
查看>>
抽象工厂
查看>>
linux下高可用mysql
查看>>
(15)Reactor 3 Operators——响应式Spring的道法术器
查看>>
r710 网卡驱动升级灰常蛋疼,现在在祈祷
查看>>
Microsoft Internet Explorer 数字错误漏洞
查看>>
RabbitMQ的远程Web管理与监控工具
查看>>
Linux术语全称
查看>>
Weave and Docker for Mac: The bridge between local and remote services
查看>>
MacOS Sierra安装nodejs
查看>>