Change api events: send onDocumentStateChange only after onDocumentReady, don't send false on loading.

This commit is contained in:
Julia Radzhabova 2021-03-09 17:06:44 +03:00
parent ef9f6048c6
commit 8974612ff4
6 changed files with 24 additions and 19 deletions

View file

@ -156,7 +156,7 @@ define([
weakCompare : function(obj1, obj2){return obj1.type === obj2.type;}
});
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false};
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false, isDocModified: false};
this.languages = null;
// Initialize viewport
@ -1798,7 +1798,7 @@ define([
if (window.document.title != title)
window.document.title = title;
Common.Gateway.setDocumentModified(isModified);
this._isDocReady && (this._state.isDocModified !== isModified) && Common.Gateway.setDocumentModified(isModified);
if (isModified && (!this._state.fastCoauth || this._state.usersCount<2))
this.getApplication().getController('Statusbar').setStatusCaption('', true);
@ -1809,7 +1809,7 @@ define([
onDocumentModifiedChanged: function() {
var isModified = this.api.asc_isDocumentCanSave();
if (this._state.isDocModified !== isModified) {
Common.Gateway.setDocumentModified(this.api.isDocumentModified());
this._isDocReady && Common.Gateway.setDocumentModified(this.api.isDocumentModified());
}
this.updateWindowTitle();

View file

@ -80,7 +80,8 @@ define([
usersCount : 1,
fastCoauth : true,
lostEditingRights : false,
licenseType : false
licenseType : false,
isDocModified: false
};
// Initialize viewport
@ -1144,7 +1145,7 @@ define([
if (window.document.title != title)
window.document.title = title;
Common.Gateway.setDocumentModified(isModified);
this._isDocReady && (this._state.isDocModified !== isModified) && Common.Gateway.setDocumentModified(isModified);
this._state.isDocModified = isModified;
}
},
@ -1152,7 +1153,7 @@ define([
onDocumentModifiedChanged: function() {
var isModified = this.api.asc_isDocumentCanSave();
if (this._state.isDocModified !== isModified) {
Common.Gateway.setDocumentModified(this.api.isDocumentModified());
this._isDocReady && Common.Gateway.setDocumentModified(this.api.isDocumentModified());
}
this.updateWindowTitle();

View file

@ -134,7 +134,7 @@ define([
onLaunch: function() {
var me = this;
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false};
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false, isDocModified: false};
this.languages = null;
window.storagename = 'presentation';
@ -1469,7 +1469,7 @@ define([
if ( window.document.title != title )
window.document.title = title;
Common.Gateway.setDocumentModified(isModified);
this._isDocReady && (this._state.isDocModified !== isModified) && Common.Gateway.setDocumentModified(isModified);
if (isModified && (!this._state.fastCoauth || this._state.usersCount<2))
this.getApplication().getController('Statusbar').setStatusCaption('', true);
@ -1483,7 +1483,7 @@ define([
onDocumentModifiedChanged: function() {
var isModified = this.api.asc_isDocumentCanSave();
if (this._state.isDocModified !== isModified) {
Common.Gateway.setDocumentModified(this.api.isDocumentModified());
this._isDocReady && Common.Gateway.setDocumentModified(this.api.isDocumentModified());
}
this.updateWindowTitle();

View file

@ -80,7 +80,8 @@ define([
usersCount : 1,
fastCoauth : true,
lostEditingRights : false,
licenseType : false
licenseType : false,
isDocModified: false
};
// Initialize viewport
@ -1063,7 +1064,7 @@ define([
if (window.document.title != title)
window.document.title = title;
Common.Gateway.setDocumentModified(isModified);
this._isDocReady && (this._state.isDocModified !== isModified) && Common.Gateway.setDocumentModified(isModified);
this._state.isDocModified = isModified;
}
},
@ -1071,7 +1072,7 @@ define([
onDocumentModifiedChanged: function() {
var isModified = this.api.asc_isDocumentCanSave();
if (this._state.isDocModified !== isModified) {
Common.Gateway.setDocumentModified(this.api.isDocumentModified());
this._isDocReady && Common.Gateway.setDocumentModified(this.api.isDocumentModified());
}
this.updateWindowTitle();

View file

@ -161,7 +161,7 @@ define([
// $(document.body).css('position', 'absolute');
var me = this;
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false};
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false, isDocModified: false};
if (!Common.Utils.isBrowserSupported()){
Common.Utils.showBrowserRestriction();
@ -1739,7 +1739,7 @@ define([
window.document.title = title;
}
Common.Gateway.setDocumentModified(change);
this._isDocReady && (this._state.isDocModified !== change) && Common.Gateway.setDocumentModified(change);
this._state.isDocModified = change;
}
@ -1750,8 +1750,10 @@ define([
onDocumentModifiedChanged: function(change) {
this.updateWindowTitle(change);
Common.Gateway.setDocumentModified(change);
if (this._state.isDocModified !== change) {
this._isDocReady && Common.Gateway.setDocumentModified(change);
}
if (this.toolbarView && this.toolbarView.btnCollabChanges && this.api) {
var isSyncButton = this.toolbarView.btnCollabChanges.cmpEl.hasClass('notify'),
forcesave = this.appOptions.forcesave,

View file

@ -81,7 +81,8 @@ define([
usersCount : 1,
fastCoauth : true,
lostEditingRights : false,
licenseType : false
licenseType : false,
isDocModified: false
};
// Initialize viewport
@ -1209,7 +1210,7 @@ define([
if (window.document.title != title)
window.document.title = title;
Common.Gateway.setDocumentModified(isModified);
this._isDocReady && (this._state.isDocModified !== isModified) && Common.Gateway.setDocumentModified(isModified);
this._state.isDocModified = isModified;
}
},
@ -1217,7 +1218,7 @@ define([
onDocumentModifiedChanged: function() {
var isModified = this.api.asc_isDocumentCanSave();
if (this._state.isDocModified !== isModified) {
Common.Gateway.setDocumentModified(this.api.asc_isDocumentModified());
this._isDocReady && Common.Gateway.setDocumentModified(this.api.asc_isDocumentModified());
}
this.updateWindowTitle();