Tp6下ueditor上传设置
1:粘贴内容图片重载问题修改 ueditor.config.js 在 window.UEDITOR_CONFIG 中 catchRemoteImageEnable:false 配置项
2:去掉编辑器图片中间的空白分割块,以及图片显示宽度
修改ueditor.all.js
2:去掉编辑器图片中间的空白分割块,以及图片显示宽度
修改ueditor.all.js
<div>render: function (container){
<span style="white-space:pre"> </span>//设置图片最大宽度,以免撑出滚动条
<span style="white-space:pre"> </span>'img{max-width:100%;vertical-align:top;outline-width:0px;}'+
<span style="white-space:pre"> </span>//设置段落间距
<span style="white-space:pre"> </span>"p{margin:0;}" +
<span style="white-space:pre"> </span>"p:last-child{margin-bottom:9px;}</style>" +
}</div>
3:关闭本地保存
修改 ueditor.all.js
<div>'contentchange': function () {
<span style="white-space:pre"> </span>if (!me.getOpt('enableAutoSave')) {
<span style="white-space:pre"> </span> return;
<span style="white-space:pre"> </span>}
<span style="white-space:pre"> </span>...</div>
4:大文件上传超时
修改 webuploader.js
<div>Transport.options = {
<span style="white-space:pre"> </span>server: '',
<span style="white-space:pre"> </span>method: 'POST',
<span style="white-space:pre"> </span>// 跨域时,是否允许携带cookie, 只有html5 runtime才有效
<span style="white-space:pre"> </span>withCredentials: false,
<span style="white-space:pre"> </span>fileVal: 'file',
<span style="white-space:pre"> </span>timeout: 30 * 60 * 1000, // luoyi 修改为30分钟
<span style="white-space:pre"> </span>formData: {},
<span style="white-space:pre"> </span>headers: {},
<span style="white-space:pre"> </span>sendAsBinary: false
<span style="white-space:pre"> </span>};</div>
5:多图片上传图片顺序
修改 ueditor/dialogs/image/image.js
<div>uploader.on('uploadSuccess', function (file, ret) {
<span style="white-space:pre"> </span>...
<span style="white-space:pre"> </span>if (json.state == 'SUCCESS') {
// _this.imageList.push(json);
_this.imageList[$file.index()] = json;
$file.append('<span class="success"></span>');
}</div>
6:多图上传时,修改图片的尺寸
修改 ueditor/jsp/config.json
<div>"imageCompressEnable": true, /* 是否压缩图片,默认是true */
"imageCompressBorder": 8800, /* 图片压缩最长边限制 */</div>
7:单图上传
修改 ueditor.all.js
<div>if(json.state == 'SUCCESS' && json.url) {
<span style="white-space:pre"> </span>loader = me.document.getElementById(loadingId);
<span style="white-space:pre"> </span>loader.setAttribute('src', link);
<span style="white-space:pre"> </span>loader.setAttribute('_src', link);
<span style="white-space:pre"> </span>loader.setAttribute('title', json.title || '');
<span style="white-space:pre"> </span>loader.setAttribute('alt', json.original || '');
<span style="white-space:pre"> </span>loader.setAttribute('width', 800); 修改
<span style="white-space:pre"> </span>loader.setAttribute('height', 600); 修改
<span style="white-space:pre"> </span>loader.removeAttribute('id');
<span style="white-space:pre"> </span>domUtils.removeClasses(loader, 'loadingclass');
}</div>
8:去掉图片上传后的title以及alt
修改 ueditor.all.js
<div>if(json.state == 'SUCCESS' && json.url) {
loader = me.document.getElementById(loadingId);
loader.setAttribute('src', link);
loader.setAttribute('_src', link);
loader.removeAttribute('title', json.title || '');//去除title
loader.removeAttribute('alt', json.original || '');//去除alt
loader.removeAttribute('id');
domUtils.removeClasses(loader, 'loadingclass');
}</div>
页:
[1]