[DE] defined button to indicate coauth changes
This commit is contained in:
parent
6d0a353d78
commit
09b9947051
|
@ -912,7 +912,7 @@ define([
|
||||||
var toolbar = this.toolbar;
|
var toolbar = this.toolbar;
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
var isModified = this.api.asc_isDocumentCanSave();
|
var isModified = this.api.asc_isDocumentCanSave();
|
||||||
var isSyncButton = toolbar.btnSave.$icon.hasClass('btn-synch');
|
var isSyncButton = toolbar.btnCollabChanges.$icon.hasClass('btn-synch');
|
||||||
if (!isModified && !isSyncButton && !toolbar.mode.forcesave)
|
if (!isModified && !isSyncButton && !toolbar.mode.forcesave)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,7 @@ define([
|
||||||
signals: ['disabled']
|
signals: ['disabled']
|
||||||
});
|
});
|
||||||
this.toolbarControls.push(this.btnSave);
|
this.toolbarControls.push(this.btnSave);
|
||||||
|
this.btnCollabChanges = this.btnSave;
|
||||||
|
|
||||||
this.btnUndo = new Common.UI.Button({
|
this.btnUndo = new Common.UI.Button({
|
||||||
id: 'id-toolbar-btn-undo',
|
id: 'id-toolbar-btn-undo',
|
||||||
|
@ -2116,21 +2117,21 @@ define([
|
||||||
/** coauthoring begin **/
|
/** coauthoring begin **/
|
||||||
onCollaborativeChanges: function () {
|
onCollaborativeChanges: function () {
|
||||||
if (this._state.hasCollaborativeChanges) return;
|
if (this._state.hasCollaborativeChanges) return;
|
||||||
if (!this.btnSave.rendered || this._state.previewmode) {
|
if (!this.btnCollabChanges.rendered || this._state.previewmode) {
|
||||||
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);
|
||||||
|
@ -2139,29 +2140,30 @@ 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("de-hide-synch", 1);
|
Common.localStorage.setItem("de-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._state.previewmode && this.btnSave.rendered) {
|
if ( !this._state.previewmode && 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(me.btnSaveCls);
|
me.btnCollabChanges.$icon.removeClass('btn-synch').addClass(me.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;
|
||||||
}
|
}
|
||||||
|
@ -2175,16 +2177,18 @@ define([
|
||||||
editusers.push(item);
|
editusers.push(item);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var me = this;
|
||||||
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 !== me.btnSaveCls && me.btnCollabChanges.rendered ) {
|
||||||
this.btnSaveTip = ((length > 1) ? this.tipSaveCoauth : this.tipSave ) + Common.Utils.String.platformKey('Ctrl+S');
|
me.btnSaveTip = ((length > 1) ? me.tipSaveCoauth : me.tipSave ) + Common.Utils.String.platformKey('Ctrl+S');
|
||||||
|
|
||||||
|
if ( !me.btnCollabChanges.$icon.hasClass('btn-synch') ) {
|
||||||
|
me.btnCollabChanges.$icon.removeClass(me.btnSaveCls).addClass(cls);
|
||||||
|
me.btnCollabChanges.updateHint(me.btnSaveTip);
|
||||||
|
|
||||||
if ( !this.btnSave.$icon.hasClass('btn-synch') ) {
|
|
||||||
this.btnSave.$icon.removeClass(this.btnSaveCls).addClass(cls);
|
|
||||||
this.btnSave.updateHint(this.btnSaveTip);
|
|
||||||
}
|
}
|
||||||
this.btnSaveCls = cls;
|
me.btnSaveCls = cls;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue