UEditor 1.2.5 for java 自定义配置

一、自定义工具栏 html


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

,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"]]

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



二、减小用户管理图片的功能(不少应用都有这个需求,只但愿用户上传图片,并不但愿他们能够看到其余图片的信息,所以咱们须要隐藏红圈部分) jsp

打开项目中的ueditor/dialogs/image/image.html,找到<span tabSrc="imgManager" 和
<span tabSrc="imgSearch"  还有 <div class="saveDir"  3个元素,都加上style=”display:none;”样式,把上述3个部分隐藏掉.

ide



三、修改默认的图片和文件上传路径 工具

Ueditor默认的图片和文件上传路径为/webname/ueditor/jsp/upload下
若是须要修改图片和文件的上传路径,不但须要修改editor_config.js配置文件,还要修改Uploader.java(某些状况还须要修改/webname/ueditor/jsp/下的imageUp.jsp和fileUp.jsp,具体根据须要而定)
this


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


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

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

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");

.

相关文章
相关标签/搜索