在ueditor.all.js中找到me.execCommand("inserthtml",html.join(""),true);在这句后面加上
me.fireEvent('afterUpVideo',videoObjs); //监听视频上传结束
变成下面这样的
me.commands["insertvideo"] = {
execCommand: function (cmd, videoObjs, type){
videoObjs = utils.isArray(videoObjs)?videoObjs:[videoObjs];
var html = [],id = 'tmpVedio', cl;
for(var i=0,vi,len = videoObjs.length;i<len;i++){
vi = videoObjs[i];
cl = (type == 'upload' ? 'edui-upload-video video-js vjs-default-skin':'edui-faked-video');
html.push(creatInsertStr( vi.url, vi.width || 420, vi.height || 280, id + i, null, cl, 'image'));
}
me.execCommand("inserthtml",html.join(""),true);
me.fireEvent('afterUpVideo',videoObjs); //监听视频上传结束
var rng = this.selection.getRange();
for(var i= 0,len=videoObjs.length;i<len;i++){
var img = this.document.getElementById('tmpVedio'+i);
domUtils.removeAttributes(img,'id');
rng.selectNode(img).select();
me.execCommand('imagefloat',videoObjs[i].align)
}
},
queryCommandState : function(){
var img = me.selection.getRange().getClosedNode(),
flag = img && (img.className == "edui-faked-video" || img.className.indexOf("edui-upload-video")!=-1);
return flag ? 1 : 0;
}
};
接下来在jsp页面初始化ueditor时添加
_editor.addListener('afterUpVideo',function(t, arg) {
console.log(arg);
});