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;} 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; this.languages = null;
// Initialize viewport // Initialize viewport
@ -1798,7 +1798,7 @@ define([
if (window.document.title != title) if (window.document.title != title)
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)) if (isModified && (!this._state.fastCoauth || this._state.usersCount<2))
this.getApplication().getController('Statusbar').setStatusCaption('', true); this.getApplication().getController('Statusbar').setStatusCaption('', true);
@ -1809,7 +1809,7 @@ define([
onDocumentModifiedChanged: function() { onDocumentModifiedChanged: function() {
var isModified = this.api.asc_isDocumentCanSave(); var isModified = this.api.asc_isDocumentCanSave();
if (this._state.isDocModified !== isModified) { if (this._state.isDocModified !== isModified) {
Common.Gateway.setDocumentModified(this.api.isDocumentModified()); this._isDocReady && Common.Gateway.setDocumentModified(this.api.isDocumentModified());
} }
this.updateWindowTitle(); this.updateWindowTitle();

View file

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

View file

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

View file

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

View file

@ -161,7 +161,7 @@ define([
// $(document.body).css('position', 'absolute'); // $(document.body).css('position', 'absolute');
var me = this; 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()){ if (!Common.Utils.isBrowserSupported()){
Common.Utils.showBrowserRestriction(); Common.Utils.showBrowserRestriction();
@ -1739,7 +1739,7 @@ define([
window.document.title = title; window.document.title = title;
} }
Common.Gateway.setDocumentModified(change); this._isDocReady && (this._state.isDocModified !== change) && Common.Gateway.setDocumentModified(change);
this._state.isDocModified = change; this._state.isDocModified = change;
} }
@ -1750,7 +1750,9 @@ define([
onDocumentModifiedChanged: function(change) { onDocumentModifiedChanged: function(change) {
this.updateWindowTitle(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) { if (this.toolbarView && this.toolbarView.btnCollabChanges && this.api) {
var isSyncButton = this.toolbarView.btnCollabChanges.cmpEl.hasClass('notify'), var isSyncButton = this.toolbarView.btnCollabChanges.cmpEl.hasClass('notify'),

View file

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