ueditor事件

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' );
	}
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章