ueditor添加事件
UE.getEditor('content').addListener('blur',function(editor){...});
UE.getEditor('container').addListener('click',function(event,o){//點擊事件
console.info(ue.selection.getRange().startContainer.data);//選中值
console.info(ue.queryCommandValue('elementpath'));//選中節點
console.info(o.x + o.y);//座標
});
添加執行命令後的監聽事件
ue.addListener('afterExecCommand',function(t, e, arg){ //e爲事件類型
afterUploadImage(e);
});
單張圖片上傳返回的e爲inserthtml,多張圖片上傳返回的e爲insertimage,執行插入段落命令。
function afterUploadImage() {
if(arguments[0]=="inserthtml" || arguments[0]=="insertimage"){
ue.execCommand( 'insertparagraph' );
}
}