1、在 ueditor.config.js 中添加一个参数 is_kuayu
// 部分代码省略
UEDITOR_HOME_URL: URL
, serverUrl: "http://xxx.com/php/controller.php"
, is_kuayu: true // 新增代码
2、修改uedtitor.all.js,大约24519行,修改代码
function ajaxRequest(callback){
var newForm = new FormData(form);
$.ajax({
url: imageActionUrl,
type: 'POST',
dataType: 'json',
cache: false,
data: newForm,
processData: false,
contentType: false,
success: function(result){
callback(result)
}
});
}
function callback(){
try {
var is_kuayu = me.getOpt('is_kuayu');
if (is_kuayu === true) {
ajaxRequest(function (result) {
var link = me.options.imageUrlPrefix + result.url;
if (result.state == 'SUCCESS' && result.url) {
loader = me.document.getElementById(loadingId);
loader.setAttribute('src', link);
loader.setAttribute('_src', link);
loader.setAttribute('title', result.title || '');
loader.setAttribute('alt', result.original || '');
loader.removeAttribute('id');
domUtils.removeClasses(loader, 'loadingclass');
} else {
showErrorLoader && showErrorLoader(result.state);
}
});
} else {
var link, json, loader,
body = (iframe.contentDocument || iframe.contentWindow.document).body,
result = body.innerText || body.textContent || '';
json = (new Function("return " + result))();
link = me.options.imageUrlPrefix + json.url;
if (json.state == 'SUCCESS' && json.url) {
loader = me.document.getElementById(loadingId);
loader.setAttribute('src', link);
loader.setAttribute('_src', link);
loader.setAttribute('title', json.title || '');
loader.setAttribute('alt', json.original || '');
loader.removeAttribute('id');
domUtils.removeClasses(loader, 'loadingclass');
} else {
showErrorLoader && showErrorLoader(json.state);
}
}
}catch(er){
showErrorLoader && showErrorLoader(me.getLang('simpleupload.loadError'));
}
}
3、注意事项
这种写法是依赖jquery的,而且兼容性不是很好,但是我实在没有别的办法了!!!!