一、自定義工具欄 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");
.