[SE PE] absract 'save' button
This commit is contained in:
parent
09b9947051
commit
6cf3ee7fb9
|
@ -902,7 +902,7 @@ define([
|
||||||
var toolbar = this.toolbar;
|
var toolbar = this.toolbar;
|
||||||
if (this.api && this.api.asc_isDocumentCanSave) {
|
if (this.api && this.api.asc_isDocumentCanSave) {
|
||||||
var isModified = this.api.asc_isDocumentCanSave();
|
var isModified = this.api.asc_isDocumentCanSave();
|
||||||
var isSyncButton = this.toolbar.btnSave.$icon.hasClass('btn-synch');
|
var isSyncButton = this.toolbar.btnCollabChanges.$icon.hasClass('btn-synch');
|
||||||
if (!isModified && !isSyncButton && !this.toolbar.mode.forcesave)
|
if (!isModified && !isSyncButton && !this.toolbar.mode.forcesave)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -173,6 +173,7 @@ define([
|
||||||
lock : [_set.lostConnect],
|
lock : [_set.lostConnect],
|
||||||
signals : ['disabled']
|
signals : ['disabled']
|
||||||
});
|
});
|
||||||
|
me.btnCollabChanges = me.btnSave;
|
||||||
|
|
||||||
me.btnUndo = new Common.UI.Button({
|
me.btnUndo = new Common.UI.Button({
|
||||||
id : 'id-toolbar-btn-undo',
|
id : 'id-toolbar-btn-undo',
|
||||||
|
@ -1467,7 +1468,7 @@ define([
|
||||||
/** coauthoring begin **/
|
/** coauthoring begin **/
|
||||||
onCollaborativeChanges: function () {
|
onCollaborativeChanges: function () {
|
||||||
if (this._state.hasCollaborativeChanges) return;
|
if (this._state.hasCollaborativeChanges) return;
|
||||||
if (!this.btnSave.rendered) {
|
if (!this.btnCollabChanges.rendered) {
|
||||||
this.needShowSynchTip = true;
|
this.needShowSynchTip = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1479,15 +1480,15 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
this._state.hasCollaborativeChanges = true;
|
this._state.hasCollaborativeChanges = true;
|
||||||
this.btnSave.$icon.removeClass(this.btnSaveCls).addClass('btn-synch');
|
this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass('btn-synch');
|
||||||
if (this.showSynchTip) {
|
if (this.showSynchTip) {
|
||||||
this.btnSave.updateHint('');
|
this.btnCollabChanges.updateHint('');
|
||||||
if (this.synchTooltip === undefined)
|
if (this.synchTooltip === undefined)
|
||||||
this.createSynchTip();
|
this.createSynchTip();
|
||||||
|
|
||||||
this.synchTooltip.show();
|
this.synchTooltip.show();
|
||||||
} else {
|
} else {
|
||||||
this.btnSave.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S'));
|
this.btnCollabChanges.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S'));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.btnSave.setDisabled(false);
|
this.btnSave.setDisabled(false);
|
||||||
|
@ -1496,29 +1497,29 @@ define([
|
||||||
|
|
||||||
createSynchTip: function () {
|
createSynchTip: function () {
|
||||||
this.synchTooltip = new Common.UI.SynchronizeTip({
|
this.synchTooltip = new Common.UI.SynchronizeTip({
|
||||||
target: $('#id-toolbar-btn-save')
|
target: this.btnCollabChanges.$el
|
||||||
});
|
});
|
||||||
this.synchTooltip.on('dontshowclick', function () {
|
this.synchTooltip.on('dontshowclick', function () {
|
||||||
this.showSynchTip = false;
|
this.showSynchTip = false;
|
||||||
this.synchTooltip.hide();
|
this.synchTooltip.hide();
|
||||||
this.btnSave.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S'));
|
this.btnCollabChanges.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S'));
|
||||||
Common.localStorage.setItem("pe-hide-synch", 1);
|
Common.localStorage.setItem("pe-hide-synch", 1);
|
||||||
}, this);
|
}, this);
|
||||||
this.synchTooltip.on('closeclick', function () {
|
this.synchTooltip.on('closeclick', function () {
|
||||||
this.synchTooltip.hide();
|
this.synchTooltip.hide();
|
||||||
this.btnSave.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S'));
|
this.btnCollabChanges.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S'));
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
synchronizeChanges: function () {
|
synchronizeChanges: function () {
|
||||||
if (this.btnSave.rendered) {
|
if (this.btnCollabChanges.rendered) {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
if ( me.btnSave.$icon.hasClass('btn-synch') ) {
|
if ( me.btnCollabChanges.$icon.hasClass('btn-synch') ) {
|
||||||
me.btnSave.$icon.removeClass('btn-synch').addClass(this.btnSaveCls);
|
me.btnCollabChanges.$icon.removeClass('btn-synch').addClass(this.btnSaveCls);
|
||||||
if (this.synchTooltip)
|
if (this.synchTooltip)
|
||||||
this.synchTooltip.hide();
|
this.synchTooltip.hide();
|
||||||
this.btnSave.updateHint(this.btnSaveTip);
|
this.btnCollabChanges.updateHint(this.btnSaveTip);
|
||||||
this.btnSave.setDisabled(!me.mode.forcesave);
|
this.btnSave.setDisabled(!me.mode.forcesave);
|
||||||
|
|
||||||
this._state.hasCollaborativeChanges = false;
|
this._state.hasCollaborativeChanges = false;
|
||||||
|
@ -1535,12 +1536,12 @@ define([
|
||||||
|
|
||||||
var length = _.size(editusers);
|
var length = _.size(editusers);
|
||||||
var cls = (length > 1) ? 'btn-save-coauth' : 'btn-save';
|
var cls = (length > 1) ? 'btn-save-coauth' : 'btn-save';
|
||||||
if (cls !== this.btnSaveCls && this.btnSave.rendered) {
|
if (cls !== this.btnSaveCls && this.btnCollabChanges.rendered) {
|
||||||
this.btnSaveTip = ((length > 1) ? this.tipSaveCoauth : this.tipSave ) + Common.Utils.String.platformKey('Ctrl+S');
|
this.btnSaveTip = ((length > 1) ? this.tipSaveCoauth : this.tipSave ) + Common.Utils.String.platformKey('Ctrl+S');
|
||||||
|
|
||||||
if ( !this.btnSave.$icon.hasClass('btn-synch') ) {
|
if ( !this.btnCollabChanges.$icon.hasClass('btn-synch') ) {
|
||||||
this.btnSave.$icon.removeClass(this.btnSaveCls).addClass(cls);
|
this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass(cls);
|
||||||
this.btnSave.updateHint(this.btnSaveTip);
|
this.btnCollabChanges.updateHint(this.btnSaveTip);
|
||||||
}
|
}
|
||||||
this.btnSaveCls = cls;
|
this.btnSaveCls = cls;
|
||||||
}
|
}
|
||||||
|
|
|
@ -386,7 +386,7 @@ define([
|
||||||
onSave: function(e) {
|
onSave: function(e) {
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
var isModified = this.api.asc_isDocumentCanSave();
|
var isModified = this.api.asc_isDocumentCanSave();
|
||||||
var isSyncButton = this.toolbar.btnSave.$icon.hasClass('btn-synch');
|
var isSyncButton = this.toolbar.btnCollabChanges.$icon.hasClass('btn-synch');
|
||||||
if (!isModified && !isSyncButton && !this.toolbar.mode.forcesave)
|
if (!isModified && !isSyncButton && !this.toolbar.mode.forcesave)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -375,6 +375,7 @@ define([
|
||||||
iconCls : 'no-mask ' + me.btnSaveCls,
|
iconCls : 'no-mask ' + me.btnSaveCls,
|
||||||
signals : ['disabled']
|
signals : ['disabled']
|
||||||
});
|
});
|
||||||
|
me.btnCollabChanges = me.btnSave;
|
||||||
|
|
||||||
me.btnIncFontSize = new Common.UI.Button({
|
me.btnIncFontSize = new Common.UI.Button({
|
||||||
id : 'id-toolbar-btn-incfont',
|
id : 'id-toolbar-btn-incfont',
|
||||||
|
@ -1221,7 +1222,7 @@ define([
|
||||||
|
|
||||||
var hidetip = Common.localStorage.getItem("sse-hide-synch");
|
var hidetip = Common.localStorage.getItem("sse-hide-synch");
|
||||||
me.showSynchTip = !(hidetip && parseInt(hidetip) == 1);
|
me.showSynchTip = !(hidetip && parseInt(hidetip) == 1);
|
||||||
me.needShowSynchTip = false;
|
// me.needShowSynchTip = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
me.lockControls = [
|
me.lockControls = [
|
||||||
|
@ -1822,22 +1823,22 @@ define([
|
||||||
|
|
||||||
onApiCollaborativeChanges: function() {
|
onApiCollaborativeChanges: function() {
|
||||||
if (this._state.hasCollaborativeChanges) return;
|
if (this._state.hasCollaborativeChanges) return;
|
||||||
if (!this.btnSave.rendered) {
|
if (!this.btnCollabChanges.rendered) {
|
||||||
this.needShowSynchTip = true;
|
// this.needShowSynchTip = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._state.hasCollaborativeChanges = true;
|
this._state.hasCollaborativeChanges = true;
|
||||||
this.btnSave.$icon.removeClass(this.btnSaveCls).addClass('btn-synch');
|
this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass('btn-synch');
|
||||||
|
|
||||||
if (this.showSynchTip){
|
if (this.showSynchTip){
|
||||||
this.btnSave.updateHint('');
|
this.btnCollabChanges.updateHint('');
|
||||||
if (this.synchTooltip===undefined)
|
if (this.synchTooltip===undefined)
|
||||||
this.createSynchTip();
|
this.createSynchTip();
|
||||||
|
|
||||||
this.synchTooltip.show();
|
this.synchTooltip.show();
|
||||||
} else {
|
} else {
|
||||||
this.btnSave.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S'));
|
this.btnCollabChanges.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S'));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.btnSave.setDisabled(false);
|
this.btnSave.setDisabled(false);
|
||||||
|
@ -1846,29 +1847,29 @@ define([
|
||||||
|
|
||||||
createSynchTip: function () {
|
createSynchTip: function () {
|
||||||
this.synchTooltip = new Common.UI.SynchronizeTip({
|
this.synchTooltip = new Common.UI.SynchronizeTip({
|
||||||
target : $('#id-toolbar-btn-save')
|
target: this.btnCollabChanges.$el
|
||||||
});
|
});
|
||||||
this.synchTooltip.on('dontshowclick', function() {
|
this.synchTooltip.on('dontshowclick', function() {
|
||||||
this.showSynchTip = false;
|
this.showSynchTip = false;
|
||||||
this.synchTooltip.hide();
|
this.synchTooltip.hide();
|
||||||
this.btnSave.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S'));
|
this.btnCollabChanges.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S'));
|
||||||
Common.localStorage.setItem('sse-hide-synch', 1);
|
Common.localStorage.setItem('sse-hide-synch', 1);
|
||||||
}, this);
|
}, this);
|
||||||
this.synchTooltip.on('closeclick', function() {
|
this.synchTooltip.on('closeclick', function() {
|
||||||
this.synchTooltip.hide();
|
this.synchTooltip.hide();
|
||||||
this.btnSave.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S'));
|
this.btnCollabChanges.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S'));
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
synchronizeChanges: function() {
|
synchronizeChanges: function() {
|
||||||
if (this.btnSave.rendered) {
|
if (this.btnCollabChanges.rendered) {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
if ( me.btnSave.$icon.hasClass('btn-synch') ) {
|
if ( me.btnCollabChanges.$icon.hasClass('btn-synch') ) {
|
||||||
me.btnSave.$icon.removeClass('btn-synch').addClass(this.btnSaveCls);
|
me.btnCollabChanges.$icon.removeClass('btn-synch').addClass(this.btnSaveCls);
|
||||||
if (this.synchTooltip)
|
if (this.synchTooltip)
|
||||||
this.synchTooltip.hide();
|
this.synchTooltip.hide();
|
||||||
this.btnSave.updateHint(this.btnSaveTip);
|
this.btnCollabChanges.updateHint(this.btnSaveTip);
|
||||||
this.btnSave.setDisabled(!me.mode.forcesave);
|
this.btnSave.setDisabled(!me.mode.forcesave);
|
||||||
|
|
||||||
this._state.hasCollaborativeChanges = false;
|
this._state.hasCollaborativeChanges = false;
|
||||||
|
@ -1885,12 +1886,12 @@ define([
|
||||||
|
|
||||||
var length = _.size(editusers);
|
var length = _.size(editusers);
|
||||||
var cls = (length>1) ? 'btn-save-coauth' : 'btn-save';
|
var cls = (length>1) ? 'btn-save-coauth' : 'btn-save';
|
||||||
if (cls !== this.btnSaveCls && this.btnSave.rendered) {
|
if (cls !== this.btnSaveCls && this.btnCollabChanges.rendered) {
|
||||||
this.btnSaveTip = ((length>1) ? this.tipSaveCoauth : this.tipSave )+ Common.Utils.String.platformKey('Ctrl+S');
|
this.btnSaveTip = ((length>1) ? this.tipSaveCoauth : this.tipSave )+ Common.Utils.String.platformKey('Ctrl+S');
|
||||||
|
|
||||||
if ( !this.btnSave.$icon.hasClass('btn-synch') ) {
|
if ( !this.btnCollabChanges.$icon.hasClass('btn-synch') ) {
|
||||||
this.btnSave.$icon.removeClass(this.btnSaveCls).addClass(cls);
|
this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass(cls);
|
||||||
this.btnSave.updateHint(this.btnSaveTip);
|
this.btnCollabChanges.updateHint(this.btnSaveTip);
|
||||||
}
|
}
|
||||||
this.btnSaveCls = cls;
|
this.btnSaveCls = cls;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue