manager.registerUI('backcolor', function (wdeditor, name) { var btn = new EditorManager.Button({ name: name, className: "icon-backColor", command: 'backcolor', wdeditor: wdeditor, cssRules: "font-weight:bold;", text: "", title: "背景色", onBtnClick: function () { console.log(this.getElement().offsetTop); // this.prop.css({"top":this.getElement().offsetTop+this.getElement().offsetHeigh // t,"left":""}); var h = this .getElement() .offsetHeight; var ofs = $(this.getElement()).offset(); ofs.top += h + 3; this .popup .showAt(ofs); }, setColor: function (color) { $(this.getElement()).css("color", color); $(this.getElement()).css("background-color", color); }, _onPickColor: function (color) { wdeditor.execCommand(this.getCommand(), color); this.setColor(color); this .popup .hide(); }, _onpicknocolor: function (color) { this .popup .hide(); }, setSelectionChange: function () { wdeditor .addListener("selectionchange", function () { var value = wdeditor.queryCommandValue(btn.getCommand()); if (btn.setColor) { btn.setColor(value); } }); }, oninit: function () { var this_ = this; var picker = new baidu .editor .ui .ColorPicker({ noColorText: wdeditor .getUeditor() .getLang("clearColor"), editor: wdeditor.getUeditor(), onpickcolor: function (t, color) { this_._onPickColor(color); }, onpicknocolor: function (t, color) { this_._onPickNoColor(color); } }) var popup = new baidu .editor .ui .Popup({ content: picker, editor: wdeditor.getUeditor() }); this.popup = popup; } }); return btn; }); manager.registerUI('superscript', function (wdeditor, name) { var btn = new EditorManager.CheckBox({ name: name, className: "icon-superScript", text: "", title: "上标" }); return btn; }); manager.registerUI('subscript', function (wdeditor, name) { var btn = new EditorManager.CheckBox({ name: name, className: "icon-subScript", text: "", title: "下标" }); return btn; }); manager.registerUI('insertCMS', function (wdeditor, name) { var btn = new EditorManager.CheckBox({ name: name, className: "insideButton-CMS", text: "插入CMS", title: "插入CMS", onBtnClick: function () { this.wdeditor.execCommand('insertHtml', ''); } }); return btn; }); // manager.registerUI('map', function (wdeditor, name) { // var btn = new EditorManager.Button({ // name: name, // text: "地图", // title: "地图" // }); // return btn; // }); manager.registerUI("imagefloat", function (wdeditor, name) { var btn = new EditorManager.RadioGroup({ wdeditor: wdeditor, name: name, command: name, buttons: { imagenone: { name: 'none', className: "insideButton-inline", // command: "imagefloat", text: '顺排', title: '顺排' // , // onBtnClick: function () { // this.wdeditor.execCommand('imagefloat', 'none'); // } }, imageleft: { name: 'left', className: "insideButton-imageLeft", // command: "left", text: '左环绕', title: '左环绕' // , // onBtnClick: function () { // this.wdeditor.execCommand('imagefloat', 'left'); // } }, imageright: { name: 'right', className: "insideButton-imageRigh", // command: "right", text: '右环绕', title: '右环绕' // , // onBtnClick: function () { // this.wdeditor.execCommand('imagefloat', 'right'); // } }, imagecenter: { name: 'center', className: "insideButton-imageCenter", // command: "center", text: '不环绕', title: '不环绕' // , // onBtnClick: function () { // this.wdeditor.execCommand('imagefloat', 'center'); // } } } }); return btn; }); manager.registerUI("duanluo", function (wdeditor, name) { var btn = new EditorManager.ButtonGroup({ wdeditor: wdeditor, name: name, command: name, className: "insideButton-fatherDiv", cssRules: "width:160px;display:inline-block;position:relative;vertical-align:top;", buttons: { indent: { type: "button", name: "indent", cssRules: "display:inline-block;", className: "icon-indent", text: "", title: "首行缩进", label: "" }, rowspacingtop: { type: "combobox", name: "rowspacingtop", className: "icon-rowSpacingTop toolbar-button", baseClassName:"", text: "", title: "段前距", cssRules: "width:28px;color:rgba(0,0,0,0);height:28px;", onSelect: function (value) { wdeditor.execCommand("rowspacing", value, "top"); console.log(value) }, items: [{ text: 5, value: 5 }, { text: 10, value: 10 }, { text: 15, value: 15 }, { text: 20, value: 20 }, { text: 25, value: 25 } ], setSelectionChange: function () { var this_ = this; wdeditor.addListener("selectionchange", function () { var value = this_.wdeditor.getUeditor().queryCommandValue("rowspacing", "top"); this_.selectValue(value); this_.menu.hide(); }); } }, rowspacingbottom: { type: "combobox", name: "rowspacingbottom", className: "icon-rowSpacingBottom toolbar-button", baseClassName:"", text: "", title: "段后距", label: "", cssRules: "width:28px;color:rgba(0,0,0,0);height:28px;", onSelect: function (value) { wdeditor.execCommand("rowspacing", value, "bottom"); }, items: [{ text: 5, value: 5 }, { text: 10, value: 10 }, { text: 15, value: 15 }, { text: 20, value: 20 }, { text: 25, value: 25 } ], setSelectionChange: function () { var this_ = this; wdeditor.addListener("selectionchange", function () { var value = this_.wdeditor.getUeditor().queryCommandValue("rowspacing", "bottom"); this_.selectValue(value); this_.menu.hide(); }); } }, lineheight: { type: "combobox", name: "lineheight", className: "icon-lineHeight toolbar-button", baseClassName:"", text: "", title: "行间距", label: "", cssRules: "width:28px;color:rgba(0,0,0,0);height:28px;", items: [{ text: 1, value: 1 }, { text: 1.5, value: 1.5 }, { text: 1.75, value: 1.75 }, { text: 2, value: 2 }, { text: 3, value: 3 }, { text: 4, value: 4 }, { text: 5, value: 5 } ], setSelectionChange: function () { var this_ = this; wdeditor.addListener("selectionchange", function () { var value = this_.wdeditor.getUeditor().queryCommandValue("lineheight", "bottom"); this_.selectValue(value); this_.menu.hide(); }); } } } }); return btn; }); manager.registerUI('insertunorderedlist', function (wdeditor, name) { var btn = new EditorManager.CheckBox({ name: name, text: "项目", title: "项目" }); return btn; });