标签:width attr 覆盖 复制 实例化 amp mat max man
批量上传的图片在线管理没法查看图片 是因为jar包本身的Bug,这里暂时做了个替换展示。就是找到Img.js 然后搜索
img.set 替换下就好了
var url=list[i].url ;
url=url.replace("D:/JavaWorkSpace/.metadata/.me_tcat7/webapps/WebEUEdit","");
//img.setAttribute(‘src‘, urlPrefix + list[i].url + (list[i].url.indexOf(‘?
‘) == -1 ? ‘?
noCache=‘:‘&noCache=‘) + (+new Date()).toString(36) );
// img.setAttribute(‘_src‘, urlPrefix + list[i].url);
img.setAttribute(‘src‘, urlPrefix +url + (url.indexOf(‘?
‘) == -1 ?
‘?
noCache=‘:‘&noCache=‘) + (+new Date()).toString(36) );
img.setAttribute(‘_src‘, urlPrefix +url);
domUtils.addClass(icon, ‘icon‘);
API地址
http://fex.baidu.com/ueditor/#server-jsp
用起来感觉非常easy。主要配置什么的就不多说了。就把环境。这里主要是解说下我怎么搭的环境。还有经常使用的ToolBar配置,其它的视频上传路径什么的就去看api吧
UMeditor为眼下最好用简单的富文本编辑器,当中的各种文件上传等等差点儿不用配置,仅仅须要拷贝样例代码就好了
第一部:下载相应语言的源代码包,我的是jsp版。里面的index.html是最全的完整案例
第二部:新建一个webproject,而且在webroot以下穿件一个目录用来放这个富文本插件,把上面下载的全部东西复制到这个目录里面
第三部:把EU/jsp以下的jar包复制到lib以下,记住必须是拷贝进去,不能引入到项目,否则会报错。
測试是否部署成功。
直接执行项目 输入地址
http://localhost:8080/WebEUEdit/EU/jsp/controller.jsp?action=config ,假设以下提示是一个js的。文本显示就说明正确了
页面显示结果Like这样
{"snapscreenInsertAlign":"none","videoPathFormat":"/ueditor/jsp/upload/video/{yyyy}{mm}{dd}/{time}{rand:6}","videoFieldName":"upfile","fileManagerActionName":"listfile","fileUrlPrefix":"","imageUrlPrefix":"","imageAllowFiles":[".png",".jpg",".jpeg",".gif",".bmp"],"videoAllowFiles":[".flv",".swf",".mkv",".avi",".rm",".rmvb",".mpeg",".mpg",".ogg",".ogv",".mov",".wmv",".mp4",".webm",".mp3",".wav",".mid"],"filePathFormat":"/ueditor/jsp/upload/file/{yyyy}{mm}{dd}/{time}{rand:6}","fileMaxSize":51200000,"fileManagerListPath":"/ueditor/jsp/upload/file/","catcherUrlPrefix":"","videoActionName":"uploadvideo","scrawlInsertAlign":"none","videoUrlPrefix":"","imageManagerUrlPrefix":"","scrawlUrlPrefix":"","imageFieldName":"upfile","fileManagerAllowFiles":[".png",".jpg",".jpeg",".gif",".bmp",".flv",".swf",".mkv",".avi",".rm",".rmvb",".mpeg",".mpg",".ogg",".ogv",".mov",".wmv",".mp4",".webm",".mp3",".wav",".mid",".rar",".zip",".tar",".gz",".7z",".bz2",".cab",".iso",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".pdf",".txt",".md",".xml"],"imageMaxSize":2048000,"catcherPathFormat":"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}","imageManagerInsertAlign":"none","scrawlFieldName":"upfile","imagePathFormat":"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}","scrawlActionName":"uploadscrawl","imageManagerActionName":"listimage","imageActionName":"uploadimage","imageManagerListSize":20,"imageManagerAllowFiles":[".png",".jpg",".jpeg",".gif",".bmp"],"fileAllowFiles":[".png",".jpg",".jpeg",".gif",".bmp",".flv",".swf",".mkv",".avi",".rm",".rmvb",".mpeg",".mpg",".ogg",".ogv",".mov",".wmv",".mp4",".webm",".mp3",".wav",".mid",".rar",".zip",".tar",".gz",".7z",".bz2",".cab",".iso",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".pdf",".txt",".md",".xml"],"snapscreenActionName":"uploadimage","fileFieldName":"upfile","fileActionName":"uploadfile","catcherActionName":"catchimage","fileManagerListSize":20,"catcherAllowFiles":[".png",".jpg",".jpeg",".gif",".bmp"],"snapscreenPathFormat":"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}","imageCompressBorder":1600,"snapscreenUrlPrefix":"","imageCompressEnable":true,"catcherLocalDomain":["127.0.0.1","localhost","img.baidu.com"],"imageManagerListPath":"/ueditor/jsp/upload/image/","imageInsertAlign":"none","catcherMaxSize":2048000,"videoMaxSize":102400000,"fileManagerUrlPrefix":"","scrawlPathFormat":"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}","scrawlMaxSize":2048000,"catcherFieldName":"source"}
上面 就是代表代码已经部署上去 以下是使用
在一个jsp页面上这样写代码
引入一下3个
<script type="text/javascript" charset="utf-8" src="EU/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="EU/ueditor.all.min.js"> </script>
<!--建议手动加在语言,避免在ie下有时由于载入语言失败导致编辑器载入失败-->
<!--这里载入的语言文件会覆盖你在配置项目里加入的语言类型。比方你在配置项目里配置的是英文。这里载入的中文,那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="EU/lang/zh-cn/zh-cn.js"></script>
<body>
<script id="editor" type="text/plain" style="width:1024px;height:500px;">这个就是富文本的元素</script>
<button onclick="getContent()">获得内容</button>
<script type="text/javascript">
//实例化编辑器
//建议使用工厂方法getEditor创建和引用编辑器实例。假设在某个闭包下引用该编辑器,直接调用UE.getEditor(‘editor‘)就能拿到相关的实例
var ue = UE.getEditor(‘editor‘);
function getContent() {
var arr = [];
arr.push("使用editor.getContent()方法能够获得编辑器的内容");
arr.push("内容为:");
arr.push(UE.getEditor(‘editor‘).getContent());
alert(arr.join("\n"));
}
</script>
</body>
经过上面 訪问jsp页面 就好了 当中文件上传什么的 所有不须要配置了,仅仅须要自己去配置相关文件上传路径就好了这个能够去看api 系统默认的上传路径是webroot下的edit文件,里面有img file 等等类型的文件上传
最后效果
关于富文本上面的toolbar可在这里配置
相关上传文件的配置 能够再这里自己去看
标签:width attr 覆盖 复制 实例化 amp mat max man
原文地址:http://www.cnblogs.com/mthoutai/p/7039690.html