百度编辑器自定义按钮
//添加自已的图片上传
UE.registerUI('upimg', function(editor, uiName) {
	//注册按钮执行时的command命令,使用命令默认就会带有回退操作
	editor.registerCommand(uiName, {
		execCommand: function() {
			this.execCommand('insertHtml', '<div>向编辑器插入的内容</div>');
		}
	});
	//创建一个button
	var btn = new UE.ui.Button({
		//按钮的名字
		name: uiName,
		//提示
		title: uiName,
		//添加额外样式,指定icon图标,这里默认使用一个重复的icon
		cssRules: 'background-position: 619px 0;',
		//点击时执行的命令
		onclick: function() {
			//这里可以不用执行命令,做你自己的操作也可
			editor.execCommand(uiName);
		}
	});
	//当点到编辑内容上时,按钮要做的状态反射
	editor.addListener('selectionchange', function() {
		var state = editor.queryCommandState(uiName);
		if (state == -1) {
			btn.setDisabled(true);
			btn.setChecked(false);
		} else {
			btn.setDisabled(false);
			btn.setChecked(state);
		}
	});
	//因为你是添加button,所以需要返回这个button
	return btn;
});主要是这一句,处理好你的罗辑后,需要向编辑器插入的内容
this.execCommand('insertHtml', '<div>向编辑器插入的内容</div>');