diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 4523d9ad09..b1c02f23f8 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -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(){ diff --git a/apps/documenteditor/main/app/view/FileMenu.js b/apps/documenteditor/main/app/view/FileMenu.js index 34c8bcf906..3f55df63f8 100644 --- a/apps/documenteditor/main/app/view/FileMenu.js +++ b/apps/documenteditor/main/app/view/FileMenu.js @@ -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]); }, diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 549b378413..09ec2e24f0 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -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(){ diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index e5dbadd85c..9f6c8efe05 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -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