[Common] refactoring. defined $icon element for a button
This commit is contained in:
parent
fc6c6c2cb8
commit
6d0a353d78
|
@ -350,6 +350,7 @@ define([
|
|||
me.menu.render(me.cmpEl);
|
||||
|
||||
parentEl.html(me.cmpEl);
|
||||
me.$icon = me.$el.find('.icon');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1323,8 +1323,6 @@ define([
|
|||
Array.prototype.push.apply(me.paragraphControls, me.btnsPageBreak);
|
||||
}.call(this);
|
||||
|
||||
this.btnSave.$icon = $('.icon', this.btnSave.cmpEl);
|
||||
this.btnHorizontalAlign.$icon = $('.icon', this.btnHorizontalAlign.cmpEl);
|
||||
return $host;
|
||||
},
|
||||
|
||||
|
|
|
@ -514,14 +514,9 @@ define([
|
|||
btnHorizontalAlign.menu.clearAll();
|
||||
}
|
||||
|
||||
if (btnHorizontalAlign.rendered) {
|
||||
var iconEl = $('.icon', btnHorizontalAlign.cmpEl);
|
||||
|
||||
if (iconEl) {
|
||||
iconEl.removeClass(btnHorizontalAlign.options.icls);
|
||||
if ( btnHorizontalAlign.rendered && btnHorizontalAlign.$icon ) {
|
||||
btnHorizontalAlign.$icon.removeClass(btnHorizontalAlign.options.icls).addClass(align);
|
||||
btnHorizontalAlign.options.icls = align;
|
||||
iconEl.addClass(btnHorizontalAlign.options.icls);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -547,14 +542,9 @@ define([
|
|||
btnVerticalAlign.menu.clearAll();
|
||||
}
|
||||
|
||||
if (btnVerticalAlign.rendered) {
|
||||
var iconEl = $('.icon', btnVerticalAlign.cmpEl);
|
||||
|
||||
if (iconEl) {
|
||||
iconEl.removeClass(btnVerticalAlign.options.icls);
|
||||
if ( btnVerticalAlign.rendered && btnVerticalAlign.$icon ) {
|
||||
btnVerticalAlign.$icon.removeClass(btnVerticalAlign.options.icls).addClass(align);
|
||||
btnVerticalAlign.options.icls = align;
|
||||
iconEl.addClass(btnVerticalAlign.options.icls);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -912,7 +902,7 @@ define([
|
|||
var toolbar = this.toolbar;
|
||||
if (this.api && this.api.asc_isDocumentCanSave) {
|
||||
var isModified = this.api.asc_isDocumentCanSave();
|
||||
var isSyncButton = $('.icon', this.toolbar.btnSave.cmpEl).hasClass('btn-synch');
|
||||
var isSyncButton = this.toolbar.btnSave.$icon.hasClass('btn-synch');
|
||||
if (!isModified && !isSyncButton && !this.toolbar.mode.forcesave)
|
||||
return;
|
||||
|
||||
|
@ -1046,14 +1036,11 @@ define([
|
|||
|
||||
onMenuHorizontalAlignSelect: function(menu, item) {
|
||||
this._state.pralign = undefined;
|
||||
var btnHorizontalAlign = this.toolbar.btnHorizontalAlign,
|
||||
iconEl = $('.icon', btnHorizontalAlign.cmpEl);
|
||||
var btnHorizontalAlign = this.toolbar.btnHorizontalAlign;
|
||||
|
||||
if (iconEl) {
|
||||
iconEl.removeClass(btnHorizontalAlign.options.icls);
|
||||
btnHorizontalAlign.$icon.removeClass(btnHorizontalAlign.options.icls);
|
||||
btnHorizontalAlign.options.icls = !item.checked ? 'btn-align-left' : item.options.icls;
|
||||
iconEl.addClass(btnHorizontalAlign.options.icls);
|
||||
}
|
||||
btnHorizontalAlign.$icon.addClass(btnHorizontalAlign.options.icls);
|
||||
|
||||
if (this.api && item.checked)
|
||||
this.api.put_PrAlign(item.value);
|
||||
|
@ -1063,14 +1050,11 @@ define([
|
|||
},
|
||||
|
||||
onMenuVerticalAlignSelect: function(menu, item) {
|
||||
var btnVerticalAlign = this.toolbar.btnVerticalAlign,
|
||||
iconEl = $('.icon', btnVerticalAlign.cmpEl);
|
||||
var btnVerticalAlign = this.toolbar.btnVerticalAlign;
|
||||
|
||||
if (iconEl) {
|
||||
iconEl.removeClass(btnVerticalAlign.options.icls);
|
||||
btnVerticalAlign.$icon.removeClass(btnVerticalAlign.options.icls);
|
||||
btnVerticalAlign.options.icls = !item.checked ? 'btn-align-middle' : item.options.icls;
|
||||
iconEl.addClass(btnVerticalAlign.options.icls);
|
||||
}
|
||||
btnVerticalAlign.$icon.addClass(btnVerticalAlign.options.icls);
|
||||
|
||||
this._state.vtextalign = undefined;
|
||||
if (this.api && item.checked)
|
||||
|
|
|
@ -1012,8 +1012,6 @@ define([
|
|||
}
|
||||
});
|
||||
|
||||
me.btnSave.$icon = $('.icon', me.btnSave.cmpEl);
|
||||
|
||||
var created = me.btnsInsertImage.concat(me.btnsInsertText, me.btnsInsertShape, me.btnsAddSlide);
|
||||
this.lockToolbar(PE.enumLock.disableOnStart, true, {array: created});
|
||||
|
||||
|
|
|
@ -495,8 +495,7 @@ define([
|
|||
},
|
||||
|
||||
onSubscriptMenu: function(menu, item) {
|
||||
var btnSubscript = this.toolbar.btnSubscript,
|
||||
iconEl = $('.icon', btnSubscript.cmpEl);
|
||||
var btnSubscript = this.toolbar.btnSubscript;
|
||||
|
||||
if (item.value == 'sub') {
|
||||
this._state.subscript = undefined;
|
||||
|
@ -506,9 +505,8 @@ define([
|
|||
this.api.asc_setCellSuperscript(item.checked);
|
||||
}
|
||||
if (item.checked) {
|
||||
iconEl.removeClass(btnSubscript.options.icls);
|
||||
btnSubscript.$icon.removeClass(btnSubscript.options.icls).addClass(item.options.icls);
|
||||
btnSubscript.options.icls = item.options.icls;
|
||||
iconEl.addClass(btnSubscript.options.icls);
|
||||
}
|
||||
|
||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||
|
@ -613,13 +611,8 @@ define([
|
|||
bordersColor = btnBorders.options.borderscolor;
|
||||
|
||||
if ( btnBorders.rendered ) {
|
||||
var iconEl = $('.icon', btnBorders.cmpEl);
|
||||
|
||||
if (iconEl) {
|
||||
iconEl.removeClass(btnBorders.options.icls);
|
||||
btnBorders.$icon.removeClass(btnBorders.options.icls).addClass(item.options.icls);
|
||||
btnBorders.options.icls = item.options.icls;
|
||||
iconEl.addClass(btnBorders.options.icls);
|
||||
}
|
||||
}
|
||||
|
||||
btnBorders.options.borderId = item.options.borderId;
|
||||
|
@ -681,14 +674,11 @@ define([
|
|||
},
|
||||
|
||||
onHorizontalAlignMenu: function(menu, item) {
|
||||
var btnHorizontalAlign = this.toolbar.btnHorizontalAlign,
|
||||
iconEl = $('.icon', btnHorizontalAlign.cmpEl);
|
||||
var btnHorizontalAlign = this.toolbar.btnHorizontalAlign;
|
||||
|
||||
if (iconEl) {
|
||||
iconEl.removeClass(btnHorizontalAlign.options.icls);
|
||||
btnHorizontalAlign.$icon.removeClass(btnHorizontalAlign.options.icls);
|
||||
btnHorizontalAlign.options.icls = !item.checked ? 'btn-align-left' : item.options.icls;
|
||||
iconEl.addClass(btnHorizontalAlign.options.icls);
|
||||
}
|
||||
btnHorizontalAlign.$icon.addClass(btnHorizontalAlign.options.icls);
|
||||
|
||||
this._state.pralign = undefined;
|
||||
if (this.api)
|
||||
|
@ -701,14 +691,11 @@ define([
|
|||
},
|
||||
|
||||
onVerticalAlignMenu: function(menu, item) {
|
||||
var btnVerticalAlign = this.toolbar.btnVerticalAlign,
|
||||
iconEl = $('.icon', btnVerticalAlign.cmpEl);
|
||||
var btnVerticalAlign = this.toolbar.btnVerticalAlign;
|
||||
|
||||
if (iconEl) {
|
||||
iconEl.removeClass(btnVerticalAlign.options.icls);
|
||||
btnVerticalAlign.$icon.removeClass(btnVerticalAlign.options.icls);
|
||||
btnVerticalAlign.options.icls = !item.checked ? 'btn-valign-bottom' : item.options.icls;
|
||||
iconEl.addClass(btnVerticalAlign.options.icls);
|
||||
}
|
||||
btnVerticalAlign.$icon.addClass(btnVerticalAlign.options.icls);
|
||||
|
||||
this._state.valign = undefined;
|
||||
if (this.api)
|
||||
|
@ -1792,13 +1779,10 @@ define([
|
|||
btnSubscript.menu.clearAll();
|
||||
} else {
|
||||
btnSubscript.menu.items[index].setChecked(true);
|
||||
if (btnSubscript.rendered) {
|
||||
var iconEl = $('.icon', btnSubscript.cmpEl);
|
||||
if (iconEl) {
|
||||
iconEl.removeClass(btnSubscript.options.icls);
|
||||
if ( btnSubscript.rendered && btnSubscript.$icon ) {
|
||||
btnSubscript.$icon.removeClass(btnSubscript.options.icls);
|
||||
btnSubscript.options.icls = btnSubscript.menu.items[index].options.icls;
|
||||
iconEl.addClass(btnSubscript.options.icls);
|
||||
}
|
||||
btnSubscript.$icon.addClass(btnSubscript.options.icls);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1934,12 +1918,9 @@ define([
|
|||
} else {
|
||||
btnSubscript.menu.items[index].setChecked(true);
|
||||
if ( btnSubscript.rendered ) {
|
||||
var iconEl = $('.icon', btnSubscript.cmpEl);
|
||||
if (iconEl) {
|
||||
iconEl.removeClass(btnSubscript.options.icls);
|
||||
btnSubscript.$icon.removeClass(btnSubscript.options.icls);
|
||||
btnSubscript.options.icls = btnSubscript.menu.items[index].options.icls;
|
||||
iconEl.addClass(btnSubscript.options.icls);
|
||||
}
|
||||
btnSubscript.$icon.addClass(btnSubscript.options.icls);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2069,13 +2050,8 @@ define([
|
|||
|
||||
var btnHorizontalAlign = this.toolbar.btnHorizontalAlign;
|
||||
if ( btnHorizontalAlign.rendered ) {
|
||||
var hIconEl = $('.icon', btnHorizontalAlign.cmpEl);
|
||||
|
||||
if (hIconEl) {
|
||||
hIconEl.removeClass(btnHorizontalAlign.options.icls);
|
||||
btnHorizontalAlign.$icon.removeClass(btnHorizontalAlign.options.icls).addClass(align);
|
||||
btnHorizontalAlign.options.icls = align;
|
||||
hIconEl.addClass(btnHorizontalAlign.options.icls);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2104,13 +2080,8 @@ define([
|
|||
|
||||
var btnVerticalAlign = this.toolbar.btnVerticalAlign;
|
||||
if ( btnVerticalAlign.rendered ) {
|
||||
var vIconEl = $('.icon', btnVerticalAlign.cmpEl);
|
||||
|
||||
if (vIconEl) {
|
||||
vIconEl.removeClass(btnVerticalAlign.options.icls);
|
||||
btnVerticalAlign.$icon.removeClass(btnVerticalAlign.options.icls).addClass(align);
|
||||
btnVerticalAlign.options.icls = align;
|
||||
vIconEl.addClass(btnVerticalAlign.options.icls);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1388,7 +1388,6 @@ define([
|
|||
// replacePlacholder('#id-toolbar-short-placeholder-btn-valign', this.btnVerticalAlign);
|
||||
// replacePlacholder('#id-toolbar-short-placeholder-btn-filter', this.btnAutofilter);
|
||||
|
||||
this.btnSave.$icon = $('.icon', this.btnSave.cmpEl);
|
||||
return $host;
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue