ckeditor image align center customization(ckeditor 编辑器图像属性居中设置)

来源:互联网 发布:东北软件学院地址 编辑:程序博客网 时间:2024/09/21 08:59

修改image.js对应的部分就可以了

id:'cmbAlign',                  type:'select',                  widths:['35%','65%'],                  style:'width:90px',                  label:b.lang.common.align,                  'default':'',                  items:[                    [b.lang.common.notSet,''],                    [b.lang.common.alignLeft,'left'],                    [b.lang.common.alignRight,'right'],                    [b.lang.common.alignCenter,'center'] //=> display: block; margin-left: auto; margin-right: auto;                  ],                  onChange:function(){                    l(this.getDialog());                    o.call(this,'advanced:txtdlgGenStyle');                  },                  setup:function(B,C){                    if(B ==d){                      varD =C.getStyle('float');                      switch(D){                        case'inherit':                        case'none':                            D ='';                      }!D &&(D =(C.getAttribute('align')||'').toLowerCase());                      this.setValue(D);                    }                  },                  commit:function(B,C,D){                    varE =this.getValue();                    if(B ==d ||B ==f){                      if(E){                            switch(E){                            case'left':                                C.setStyle('float',E);                                break;                            case'right':                                C.setStyle('float',E);                                break;                            case'center':                                C.setStyle('display','block');                                C.setStyle('margin-left','auto');                                C.setStyle('margin-right','auto');                                break;                            default:                                C.setStyle('float',E);                          }                      }                      else{                        C.removeStyle('float');                        C.removeStyle('display');                        C.removeStyle('margin-right');                        C.removeStyle('margin-left');                      }                      if(!D &&B ==d){                        E =(C.getAttribute('align')||'').toLowerCase();                        console.log(E);                        switch(E){                            case'left':                                break;                            case'right':                                break;                            case'center':                            break;                          default:                            C.removeAttribute('align');                        }                      }                    }elseif(B ==g){                        C.removeStyle('float');                        C.removeStyle('display');                        C.removeStyle('margin-right');                        C.removeStyle('margin-left');                    }                  }
0 0