| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- 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', '<img cmsid="" src="/wd/js/ueditor/lang/zh-cn/images/cmsEdit.png" scrolling="no" frameborder="0" width="300px" height="350px"/>');
- }
- });
- 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;
- });
|