Fix error handling before document is ready

This commit is contained in:
Julia Radzhabova
2023-02-14 15:24:44 +03:00
parent 342d9680ee
commit 26812b2281
4 changed files with 23 additions and 5 deletions

View File

@ -1378,6 +1378,8 @@ define([
$('.doc-placeholder').remove();
this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (Common.Utils.InternalSettings.get("guest-username")===null) && this.showRenameUserDialog();
if (this._needToSaveAsFile) // warning received before document is ready
this.getApplication().getController('LeftMenu').leftMenu.showMenu('file:saveas');
},
onLicenseChanged: function(params) {
@ -2068,8 +2070,12 @@ define([
Common.UI.Menu.Manager.hideAll();
if (this.appOptions.isDesktopApp && this.appOptions.isOffline)
this.api.asc_DownloadAs();
else
(this.appOptions.canDownload) ? this.getApplication().getController('LeftMenu').leftMenu.showMenu('file:saveas') : this.api.asc_DownloadOrigin();
else {
if (this.appOptions.canDownload) {
this._isDocReady ? this.getApplication().getController('LeftMenu').leftMenu.showMenu('file:saveas') : (this._needToSaveAsFile = true);
} else
this.api.asc_DownloadOrigin();
}
} else if (id == Asc.c_oAscError.ID.SplitCellMaxRows || id == Asc.c_oAscError.ID.SplitCellMaxCols || id == Asc.c_oAscError.ID.SplitCellRowsDivider) {
var me = this;
setTimeout(function(){

View File

@ -358,7 +358,7 @@ define([
this.$el.show();
this.scroller.update();
this.selectMenu(panel, opts, defPanel);
this.api.asc_enableKeyEvents(false);
this.api && this.api.asc_enableKeyEvents(false);
this.fireEvent('menu:show', [this]);
},

View File

@ -999,6 +999,8 @@ define([
$('.doc-placeholder').remove();
this.appOptions.user.guest && this.appOptions.canRenameAnonymous && (Common.Utils.InternalSettings.get("guest-username")===null) && this.showRenameUserDialog();
if (this._needToSaveAsFile) // warning received before document is ready
this.getApplication().getController('LeftMenu').leftMenu.showMenu('file:saveas');
},
onLicenseChanged: function(params) {
@ -1663,7 +1665,11 @@ define([
config.callback = _.bind(function(btn){
if (id == Asc.c_oAscError.ID.Warning && btn == 'ok' && this.appOptions.canDownload) {
Common.UI.Menu.Manager.hideAll();
(this.appOptions.isDesktopApp && this.appOptions.isOffline) ? this.api.asc_DownloadAs() : this.getApplication().getController('LeftMenu').leftMenu.showMenu('file:saveas');
if (this.appOptions.isDesktopApp && this.appOptions.isOffline)
this.api.asc_DownloadAs();
else {
this._isDocReady ? this.getApplication().getController('LeftMenu').leftMenu.showMenu('file:saveas') : (this._needToSaveAsFile = true);
}
} else if (id == Asc.c_oAscError.ID.SplitCellMaxRows || id == Asc.c_oAscError.ID.SplitCellMaxCols || id == Asc.c_oAscError.ID.SplitCellRowsDivider) {
var me = this;
setTimeout(function(){

View File

@ -1082,6 +1082,8 @@ define([
Common.Gateway.documentReady();
if (this.appOptions.user.guest && this.appOptions.canRenameAnonymous && !this.appOptions.isEditDiagram && !this.appOptions.isEditMailMerge && !this.appOptions.isEditOle && (Common.Utils.InternalSettings.get("guest-username")===null))
this.showRenameUserDialog();
if (this._needToSaveAsFile) // warning received before document is ready
this.getApplication().getController('LeftMenu').leftMenu.showMenu('file:saveas');
},
onLicenseChanged: function(params) {
@ -2059,7 +2061,11 @@ define([
config.callback = _.bind(function(btn){
if (id == Asc.c_oAscError.ID.Warning && btn == 'ok' && this.appOptions.canDownload) {
Common.UI.Menu.Manager.hideAll();
(this.appOptions.isDesktopApp && this.appOptions.isOffline) ? this.api.asc_DownloadAs() : this.getApplication().getController('LeftMenu').leftMenu.showMenu('file:saveas');
if (this.appOptions.isDesktopApp && this.appOptions.isOffline)
this.api.asc_DownloadAs();
else {
this._isDocReady ? this.getApplication().getController('LeftMenu').leftMenu.showMenu('file:saveas') : (this._needToSaveAsFile = true);
}
} else if (id == Asc.c_oAscError.ID.EditingError) {
this.disableEditing(true);
Common.NotificationCenter.trigger('api:disconnect', true); // enable download and print