refactoring
This commit is contained in:
parent
e239437015
commit
fc6c6c2cb8
|
@ -524,14 +524,9 @@ define([
|
|||
|
||||
var btnHorizontalAlign = this.toolbar.btnHorizontalAlign;
|
||||
|
||||
if (btnHorizontalAlign.rendered) {
|
||||
var iconEl = $('.icon', btnHorizontalAlign.cmpEl);
|
||||
|
||||
if (iconEl) {
|
||||
iconEl.removeClass(btnHorizontalAlign.options.icls);
|
||||
btnHorizontalAlign.options.icls = align;
|
||||
iconEl.addClass(btnHorizontalAlign.options.icls);
|
||||
}
|
||||
if ( btnHorizontalAlign.rendered && btnHorizontalAlign.$icon ) {
|
||||
btnHorizontalAlign.$icon.removeClass(btnHorizontalAlign.options.icls).addClass(align);
|
||||
btnHorizontalAlign.options.icls = align;
|
||||
}
|
||||
|
||||
if (v === null || v===undefined) {
|
||||
|
@ -917,7 +912,7 @@ define([
|
|||
var toolbar = this.toolbar;
|
||||
if (this.api) {
|
||||
var isModified = this.api.asc_isDocumentCanSave();
|
||||
var isSyncButton = $('.icon', toolbar.btnSave.cmpEl).hasClass('btn-synch');
|
||||
var isSyncButton = toolbar.btnSave.$icon.hasClass('btn-synch');
|
||||
if (!isModified && !isSyncButton && !toolbar.mode.forcesave)
|
||||
return;
|
||||
|
||||
|
@ -1077,14 +1072,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.options.icls = !item.checked ? 'btn-align-left' : item.options.icls;
|
||||
iconEl.addClass(btnHorizontalAlign.options.icls);
|
||||
}
|
||||
btnHorizontalAlign.$icon.removeClass(btnHorizontalAlign.options.icls);
|
||||
btnHorizontalAlign.options.icls = !item.checked ? 'btn-align-left' : item.options.icls;
|
||||
btnHorizontalAlign.$icon.addClass(btnHorizontalAlign.options.icls);
|
||||
|
||||
if (this.api && item.checked)
|
||||
this.api.put_PrAlign(item.value);
|
||||
|
|
|
@ -1323,6 +1323,8 @@ 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;
|
||||
},
|
||||
|
||||
|
@ -2122,9 +2124,7 @@ define([
|
|||
}
|
||||
|
||||
this._state.hasCollaborativeChanges = true;
|
||||
var iconEl = $('.icon', this.btnSave.cmpEl);
|
||||
iconEl.removeClass(this.btnSaveCls);
|
||||
iconEl.addClass('btn-synch');
|
||||
this.btnSave.$icon.removeClass(this.btnSaveCls).addClass('btn-synch');
|
||||
if (this.showSynchTip) {
|
||||
this.btnSave.updateHint('');
|
||||
if (this.synchTooltip === undefined)
|
||||
|
@ -2157,12 +2157,10 @@ define([
|
|||
|
||||
synchronizeChanges: function () {
|
||||
if (!this._state.previewmode && this.btnSave.rendered) {
|
||||
var iconEl = $('.icon', this.btnSave.cmpEl),
|
||||
me = this;
|
||||
var me = this;
|
||||
|
||||
if (iconEl.hasClass('btn-synch')) {
|
||||
iconEl.removeClass('btn-synch');
|
||||
iconEl.addClass(this.btnSaveCls);
|
||||
if ( me.btnSave.$icon.hasClass('btn-synch') ) {
|
||||
me.btnSave.$icon.removeClass('btn-synch').addClass(me.btnSaveCls);
|
||||
if (this.synchTooltip)
|
||||
this.synchTooltip.hide();
|
||||
this.btnSave.updateHint(this.btnSaveTip);
|
||||
|
@ -2184,10 +2182,8 @@ define([
|
|||
if (cls !== this.btnSaveCls && this.btnSave.rendered) {
|
||||
this.btnSaveTip = ((length > 1) ? this.tipSaveCoauth : this.tipSave ) + Common.Utils.String.platformKey('Ctrl+S');
|
||||
|
||||
var iconEl = $('.icon', this.btnSave.cmpEl);
|
||||
if (!iconEl.hasClass('btn-synch')) {
|
||||
iconEl.removeClass(this.btnSaveCls);
|
||||
iconEl.addClass(cls);
|
||||
if ( !this.btnSave.$icon.hasClass('btn-synch') ) {
|
||||
this.btnSave.$icon.removeClass(this.btnSaveCls).addClass(cls);
|
||||
this.btnSave.updateHint(this.btnSaveTip);
|
||||
}
|
||||
this.btnSaveCls = cls;
|
||||
|
|
|
@ -1012,6 +1012,8 @@ 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});
|
||||
|
||||
|
@ -1479,9 +1481,7 @@ define([
|
|||
}
|
||||
|
||||
this._state.hasCollaborativeChanges = true;
|
||||
var iconEl = $('.icon', this.btnSave.cmpEl);
|
||||
iconEl.removeClass(this.btnSaveCls);
|
||||
iconEl.addClass('btn-synch');
|
||||
this.btnSave.$icon.removeClass(this.btnSaveCls).addClass('btn-synch');
|
||||
if (this.showSynchTip) {
|
||||
this.btnSave.updateHint('');
|
||||
if (this.synchTooltip === undefined)
|
||||
|
@ -1514,12 +1514,10 @@ define([
|
|||
|
||||
synchronizeChanges: function () {
|
||||
if (this.btnSave.rendered) {
|
||||
var iconEl = $('.icon', this.btnSave.cmpEl),
|
||||
me = this;
|
||||
var me = this;
|
||||
|
||||
if (iconEl.hasClass('btn-synch')) {
|
||||
iconEl.removeClass('btn-synch');
|
||||
iconEl.addClass(this.btnSaveCls);
|
||||
if ( me.btnSave.$icon.hasClass('btn-synch') ) {
|
||||
me.btnSave.$icon.removeClass('btn-synch').addClass(this.btnSaveCls);
|
||||
if (this.synchTooltip)
|
||||
this.synchTooltip.hide();
|
||||
this.btnSave.updateHint(this.btnSaveTip);
|
||||
|
@ -1542,10 +1540,8 @@ define([
|
|||
if (cls !== this.btnSaveCls && this.btnSave.rendered) {
|
||||
this.btnSaveTip = ((length > 1) ? this.tipSaveCoauth : this.tipSave ) + Common.Utils.String.platformKey('Ctrl+S');
|
||||
|
||||
var iconEl = $('.icon', this.btnSave.cmpEl);
|
||||
if (!iconEl.hasClass('btn-synch')) {
|
||||
iconEl.removeClass(this.btnSaveCls);
|
||||
iconEl.addClass(cls);
|
||||
if ( !this.btnSave.$icon.hasClass('btn-synch') ) {
|
||||
this.btnSave.$icon.removeClass(this.btnSaveCls).addClass(cls);
|
||||
this.btnSave.updateHint(this.btnSaveTip);
|
||||
}
|
||||
this.btnSaveCls = cls;
|
||||
|
|
|
@ -386,7 +386,7 @@ define([
|
|||
onSave: function(e) {
|
||||
if (this.api) {
|
||||
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;
|
||||
|
||||
|
|
|
@ -1388,6 +1388,7 @@ 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;
|
||||
},
|
||||
|
||||
|
@ -1828,9 +1829,7 @@ define([
|
|||
}
|
||||
|
||||
this._state.hasCollaborativeChanges = true;
|
||||
var iconEl = $('.icon', this.btnSave.cmpEl);
|
||||
iconEl.removeClass(this.btnSaveCls);
|
||||
iconEl.addClass('btn-synch');
|
||||
this.btnSave.$icon.removeClass(this.btnSaveCls).addClass('btn-synch');
|
||||
|
||||
if (this.showSynchTip){
|
||||
this.btnSave.updateHint('');
|
||||
|
@ -1864,12 +1863,10 @@ define([
|
|||
|
||||
synchronizeChanges: function() {
|
||||
if (this.btnSave.rendered) {
|
||||
var iconEl = $('.icon', this.btnSave.cmpEl),
|
||||
me = this;
|
||||
var me = this;
|
||||
|
||||
if (iconEl.hasClass('btn-synch')) {
|
||||
iconEl.removeClass('btn-synch');
|
||||
iconEl.addClass(this.btnSaveCls);
|
||||
if ( me.btnSave.$icon.hasClass('btn-synch') ) {
|
||||
me.btnSave.$icon.removeClass('btn-synch').addClass(this.btnSaveCls);
|
||||
if (this.synchTooltip)
|
||||
this.synchTooltip.hide();
|
||||
this.btnSave.updateHint(this.btnSaveTip);
|
||||
|
@ -1892,10 +1889,8 @@ define([
|
|||
if (cls !== this.btnSaveCls && this.btnSave.rendered) {
|
||||
this.btnSaveTip = ((length>1) ? this.tipSaveCoauth : this.tipSave )+ Common.Utils.String.platformKey('Ctrl+S');
|
||||
|
||||
var iconEl = $('.icon', this.btnSave.cmpEl);
|
||||
if (!iconEl.hasClass('btn-synch')) {
|
||||
iconEl.removeClass(this.btnSaveCls);
|
||||
iconEl.addClass(cls);
|
||||
if ( !this.btnSave.$icon.hasClass('btn-synch') ) {
|
||||
this.btnSave.$icon.removeClass(this.btnSaveCls).addClass(cls);
|
||||
this.btnSave.updateHint(this.btnSaveTip);
|
||||
}
|
||||
this.btnSaveCls = cls;
|
||||
|
|
Loading…
Reference in a new issue