From 0e52ef704b5eae9ba41623ad2573205c4c673b4c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Sun, 28 Mar 2021 23:59:55 +0300 Subject: [PATCH 1/3] Check unsaved changes before onRequestClose event --- .../main/app/controller/Main.js | 28 +++++++++++++++++-- apps/documenteditor/main/locale/en.json | 1 + .../main/app/controller/Main.js | 27 ++++++++++++++++-- apps/presentationeditor/main/locale/en.json | 1 + .../main/app/controller/Main.js | 27 ++++++++++++++++-- apps/spreadsheeteditor/main/locale/en.json | 1 + 6 files changed, 76 insertions(+), 9 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 535dfe7d4..321334bc1 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -709,8 +709,29 @@ define([ goBack: function(current) { if ( !Common.Controllers.Desktop.process('goback') ) { if (this.appOptions.customization.goback.requestClose && this.appOptions.canRequestClose) { - Common.Gateway.requestClose(); - // Common.Controllers.Desktop.requestClose(); + if (this.api.isDocumentModified()) { + var me = this; + this.api.asc_stopSaving(); + Common.UI.warning({ + closable: false, + width: 500, + title: this.notcriticalErrorTitle, + msg: this.leavePageTextOnClose, + buttons: ['ok', 'cancel'], + primary: 'ok', + callback: function(btn) { + if (btn == 'ok') { + me.api.asc_undoAllChanges(); + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); + } else + me.api.asc_continueSaving(); + } + }); + } else { + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); + } } else { var href = this.appOptions.customization.goback.url; if (!current && this.appOptions.customization.goback.blank!==false) { @@ -2847,7 +2868,8 @@ define([ textLongName: 'Enter a name that is less than 128 characters.', textGuest: 'Guest', errorSubmit: 'Submit failed.', - txtClickToLoad: 'Click to load image' + txtClickToLoad: 'Click to load image', + leavePageTextOnClose: 'All unsaved changes in this document will be lost.
Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.' } })(), DE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index cc0245ee8..ab3c2caa0 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -842,6 +842,7 @@ "DE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
Contact %1 sales team for personal upgrade terms.", "DE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "DE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "DE.Controllers.Main.leavePageTextOnClose": "All unsaved changes in this document will be lost.
Click \"Cancel\" then \"Save\" to save them. Click \"OK\" to discard all the unsaved changes.", "DE.Controllers.Navigation.txtBeginning": "Beginning of document", "DE.Controllers.Navigation.txtGotoBeginning": "Go to the beginning of the document", "DE.Controllers.Statusbar.textHasChanges": "New changes have been tracked", diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 2a40265c2..8fc8bc90a 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -489,8 +489,28 @@ define([ var me = this; if ( !Common.Controllers.Desktop.process('goback') ) { if (me.appOptions.customization.goback.requestClose && me.appOptions.canRequestClose) { - Common.Gateway.requestClose(); - // Common.Controllers.Desktop.requestClose(); + if (this.api.isDocumentModified()) { + this.api.asc_stopSaving(); + Common.UI.warning({ + closable: false, + width: 500, + title: this.notcriticalErrorTitle, + msg: this.leavePageTextOnClose, + buttons: ['ok', 'cancel'], + primary: 'ok', + callback: function(btn) { + if (btn == 'ok') { + me.api.asc_undoAllChanges(); + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); + } else + me.api.asc_continueSaving(); + } + }); + } else { + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); + } } else { var href = me.appOptions.customization.goback.url; if (!current && me.appOptions.customization.goback.blank!==false) { @@ -2480,7 +2500,8 @@ define([ textRenameLabel: 'Enter a name to be used for collaboration', textRenameError: 'User name must not be empty.', textLongName: 'Enter a name that is less than 128 characters.', - textGuest: 'Guest' + textGuest: 'Guest', + leavePageTextOnClose: 'All unsaved changes in this document will be lost.
Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.' } })(), PE.Controllers.Main || {})) }); diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 88aff64ca..1d831b199 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -709,6 +709,7 @@ "PE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
Contact %1 sales team for personal upgrade terms.", "PE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "PE.Controllers.Main.leavePageTextOnClose": "All unsaved changes in this presentation will be lost.
Click \"Cancel\" then \"Save\" to save them. Click \"OK\" to discard all the unsaved changes.", "PE.Controllers.Statusbar.zoomText": "Zoom {0}%", "PE.Controllers.Toolbar.confirmAddFontName": "The font you are going to save is not available on the current device.
The text style will be displayed using one of the system fonts, the saved font will be used when it is available.
Do you want to continue?", "PE.Controllers.Toolbar.textAccent": "Accents", diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 1e5c0283a..f4bdcded5 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -552,8 +552,28 @@ define([ var me = this; if ( !Common.Controllers.Desktop.process('goback') ) { if (me.appOptions.customization.goback.requestClose && me.appOptions.canRequestClose) { - Common.Gateway.requestClose(); - // Common.Controllers.Desktop.requestClose(); + if (this.api.asc_isDocumentModified()) { + this.api.asc_stopSaving(); + Common.UI.warning({ + closable: false, + width: 500, + title: this.notcriticalErrorTitle, + msg: this.leavePageTextOnClose, + buttons: ['ok', 'cancel'], + primary: 'ok', + callback: function(btn) { + if (btn == 'ok') { + me.api.asc_undoAllChanges(); + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); + } else + me.api.asc_continueSaving(); + } + }); + } else { + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); + } } else { var href = me.appOptions.customization.goback.url; if (!current && me.appOptions.customization.goback.blank!==false) { @@ -2837,7 +2857,8 @@ define([ txtMonths: 'Months', txtQuarters: 'Quarters', txtYears: 'Years', - errorPivotGroup: 'Cannot group that selection.' + errorPivotGroup: 'Cannot group that selection.', + leavePageTextOnClose: 'All unsaved changes in this document will be lost.
Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.' } })(), SSE.Controllers.Main || {})) }); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 4b33eae30..f928dafb9 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -921,6 +921,7 @@ "SSE.Controllers.Main.warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
Contact %1 sales team for personal upgrade terms.", "SSE.Controllers.Main.warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "SSE.Controllers.Main.leavePageTextOnClose": "All unsaved changes in this spreadsheet will be lost.
Click \"Cancel\" then \"Save\" to save them. Click \"OK\" to discard all the unsaved changes.", "SSE.Controllers.Print.strAllSheets": "All Sheets", "SSE.Controllers.Print.textFirstCol": "First column", "SSE.Controllers.Print.textFirstRow": "First row", From 84d357560ed950a395f1c6209a6acf8e593f8fd1 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 29 Mar 2021 14:30:31 +0300 Subject: [PATCH 2/3] Add method requestClose (show warning on unsaved changes) --- apps/api/documents/api.js | 10 +++- apps/common/Gateway.js | 4 ++ .../embed/js/ApplicationController.js | 5 ++ .../main/app/controller/Main.js | 51 ++++++++++-------- .../mobile/app/controller/Main.js | 5 ++ .../embed/js/ApplicationController.js | 5 ++ .../main/app/controller/Main.js | 52 +++++++++++-------- .../mobile/app/controller/Main.js | 5 ++ .../embed/js/ApplicationController.js | 5 ++ .../main/app/controller/Main.js | 50 ++++++++++-------- .../mobile/app/controller/Main.js | 5 ++ 11 files changed, 128 insertions(+), 69 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 534d77d8e..346ed100a 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -657,6 +657,13 @@ }); }; + var _requestClose = function(data) { + _sendCommand({ + command: 'requestClose', + data: data + }); + }; + var _processMouse = function(evt) { var r = iframe.getBoundingClientRect(); var data = { @@ -703,7 +710,8 @@ insertImage : _insertImage, setMailMergeRecipients: _setMailMergeRecipients, setRevisedFile : _setRevisedFile, - setFavorite : _setFavorite + setFavorite : _setFavorite, + requestClose : _requestClose } }; diff --git a/apps/common/Gateway.js b/apps/common/Gateway.js index 35a04ec82..de81cfb34 100644 --- a/apps/common/Gateway.js +++ b/apps/common/Gateway.js @@ -126,6 +126,10 @@ if (Common === undefined) { 'setFavorite': function(data) { $me.trigger('setfavorite', data); + }, + + 'requestClose': function(data) { + $me.trigger('requestclose', data); } }; diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index 3bf2092be..799312960 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -265,6 +265,7 @@ DE.ApplicationController = new(function(){ Common.Gateway.on('processmouse', onProcessMouse); Common.Gateway.on('downloadas', onDownloadAs); + Common.Gateway.on('requestclose', onRequestClose); DE.ApplicationView.tools.get('#idt-fullscreen') .on('click', function(){ @@ -493,6 +494,10 @@ DE.ApplicationController = new(function(){ } } + function onRequestClose() { + Common.Gateway.requestClose(); + } + function onDownloadAs() { if ( permissions.download === false) { Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 321334bc1..437e56794 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -706,32 +706,36 @@ define([ app.getController('Viewport').SetDisabled(disable); }, + onRequestClose: function() { + var me = this; + if (this.api.isDocumentModified()) { + this.api.asc_stopSaving(); + Common.UI.warning({ + closable: false, + width: 500, + title: this.notcriticalErrorTitle, + msg: this.leavePageTextOnClose, + buttons: ['ok', 'cancel'], + primary: 'ok', + callback: function(btn) { + if (btn == 'ok') { + me.api.asc_undoAllChanges(); + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); + } else + me.api.asc_continueSaving(); + } + }); + } else { + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); + } + }, + goBack: function(current) { if ( !Common.Controllers.Desktop.process('goback') ) { if (this.appOptions.customization.goback.requestClose && this.appOptions.canRequestClose) { - if (this.api.isDocumentModified()) { - var me = this; - this.api.asc_stopSaving(); - Common.UI.warning({ - closable: false, - width: 500, - title: this.notcriticalErrorTitle, - msg: this.leavePageTextOnClose, - buttons: ['ok', 'cancel'], - primary: 'ok', - callback: function(btn) { - if (btn == 'ok') { - me.api.asc_undoAllChanges(); - Common.Gateway.requestClose(); - // Common.Controllers.Desktop.requestClose(); - } else - me.api.asc_continueSaving(); - } - }); - } else { - Common.Gateway.requestClose(); - // Common.Controllers.Desktop.requestClose(); - } + this.onRequestClose(); } else { var href = this.appOptions.customization.goback.url; if (!current && this.appOptions.customization.goback.blank!==false) { @@ -1167,6 +1171,7 @@ define([ Common.Gateway.on('refreshhistory', _.bind(me.onRefreshHistory, me)); Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me)); Common.Gateway.on('setfavorite', _.bind(me.onSetFavorite, me)); + Common.Gateway.on('requestclose', _.bind(me.onRequestClose, me)); Common.Gateway.sendInfo({mode:me.appOptions.isEdit?'edit':'view'}); diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 66f8d59fc..ca00cd148 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -368,6 +368,10 @@ define([ } }, + onRequestClose: function() { + Common.Gateway.requestClose(); + }, + goBack: function(current) { if (this.appOptions.customization.goback.requestClose && this.appOptions.canRequestClose) { Common.Gateway.requestClose(); @@ -633,6 +637,7 @@ define([ Common.Gateway.on('processsaveresult', _.bind(me.onProcessSaveResult, me)); Common.Gateway.on('processrightschange', _.bind(me.onProcessRightsChange, me)); Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me)); + Common.Gateway.on('requestclose', _.bind(me.onRequestClose, me)); Common.Gateway.sendInfo({ mode: me.appOptions.isEdit ? 'edit' : 'view' diff --git a/apps/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index c251151be..9875494fd 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -273,6 +273,7 @@ PE.ApplicationController = new(function(){ Common.Gateway.on('processmouse', onProcessMouse); Common.Gateway.on('downloadas', onDownloadAs); + Common.Gateway.on('requestclose', onRequestClose); PE.ApplicationView.tools.get('#idt-fullscreen') .on('click', function(){ @@ -593,6 +594,10 @@ PE.ApplicationController = new(function(){ } } + function onRequestClose() { + Common.Gateway.requestClose(); + } + function onDownloadAs() { if ( permissions.download === false) { Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 8fc8bc90a..0781d002d 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -485,32 +485,37 @@ define([ } }, + onRequestClose: function() { + var me = this; + if (this.api.isDocumentModified()) { + this.api.asc_stopSaving(); + Common.UI.warning({ + closable: false, + width: 500, + title: this.notcriticalErrorTitle, + msg: this.leavePageTextOnClose, + buttons: ['ok', 'cancel'], + primary: 'ok', + callback: function(btn) { + if (btn == 'ok') { + me.api.asc_undoAllChanges(); + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); + } else + me.api.asc_continueSaving(); + } + }); + } else { + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); + } + }, + goBack: function(current) { var me = this; if ( !Common.Controllers.Desktop.process('goback') ) { if (me.appOptions.customization.goback.requestClose && me.appOptions.canRequestClose) { - if (this.api.isDocumentModified()) { - this.api.asc_stopSaving(); - Common.UI.warning({ - closable: false, - width: 500, - title: this.notcriticalErrorTitle, - msg: this.leavePageTextOnClose, - buttons: ['ok', 'cancel'], - primary: 'ok', - callback: function(btn) { - if (btn == 'ok') { - me.api.asc_undoAllChanges(); - Common.Gateway.requestClose(); - // Common.Controllers.Desktop.requestClose(); - } else - me.api.asc_continueSaving(); - } - }); - } else { - Common.Gateway.requestClose(); - // Common.Controllers.Desktop.requestClose(); - } + me.onRequestClose(); } else { var href = me.appOptions.customization.goback.url; if (!current && me.appOptions.customization.goback.blank!==false) { @@ -889,7 +894,8 @@ define([ Common.Gateway.on('processmouse', _.bind(me.onProcessMouse, me)); Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me)); Common.Gateway.on('setfavorite', _.bind(me.onSetFavorite, me)); - + Common.Gateway.on('requestclose', _.bind(me.onRequestClose, me)); + Common.Gateway.sendInfo({mode:me.appOptions.isEdit?'edit':'view'}); $(document).on('contextmenu', _.bind(me.onContextMenu, me)); diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js index 4c9c14894..b69ae1f9c 100644 --- a/apps/presentationeditor/mobile/app/controller/Main.js +++ b/apps/presentationeditor/mobile/app/controller/Main.js @@ -351,6 +351,10 @@ define([ this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PPTX, true)); }, + onRequestClose: function() { + Common.Gateway.requestClose(); + }, + goBack: function(current) { if (this.appOptions.customization.goback.requestClose && this.appOptions.canRequestClose) { Common.Gateway.requestClose(); @@ -579,6 +583,7 @@ define([ Common.Gateway.on('processsaveresult', _.bind(me.onProcessSaveResult, me)); Common.Gateway.on('processrightschange', _.bind(me.onProcessRightsChange, me)); Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me)); + Common.Gateway.on('requestclose', _.bind(me.onRequestClose, me)); Common.Gateway.sendInfo({ mode: me.appOptions.isEdit ? 'edit' : 'view' diff --git a/apps/spreadsheeteditor/embed/js/ApplicationController.js b/apps/spreadsheeteditor/embed/js/ApplicationController.js index ca30a2365..6833f554a 100644 --- a/apps/spreadsheeteditor/embed/js/ApplicationController.js +++ b/apps/spreadsheeteditor/embed/js/ApplicationController.js @@ -210,6 +210,7 @@ SSE.ApplicationController = new(function(){ Common.Gateway.on('processmouse', onProcessMouse); Common.Gateway.on('downloadas', onDownloadAs); + Common.Gateway.on('requestclose', onRequestClose); SSE.ApplicationView.tools.get('#idt-fullscreen') .on('click', function(){ @@ -499,6 +500,10 @@ SSE.ApplicationController = new(function(){ } } + function onRequestClose() { + Common.Gateway.requestClose(); + } + function onDownloadAs() { if ( permissions.download === false) { Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, me.errorAccessDeny); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index f4bdcded5..3e72bc703 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -548,32 +548,37 @@ define([ } }, + onRequestClose: function() { + var me = this; + if (this.api.asc_isDocumentModified()) { + this.api.asc_stopSaving(); + Common.UI.warning({ + closable: false, + width: 500, + title: this.notcriticalErrorTitle, + msg: this.leavePageTextOnClose, + buttons: ['ok', 'cancel'], + primary: 'ok', + callback: function(btn) { + if (btn == 'ok') { + me.api.asc_undoAllChanges(); + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); + } else + me.api.asc_continueSaving(); + } + }); + } else { + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); + } + }, + goBack: function(current) { var me = this; if ( !Common.Controllers.Desktop.process('goback') ) { if (me.appOptions.customization.goback.requestClose && me.appOptions.canRequestClose) { - if (this.api.asc_isDocumentModified()) { - this.api.asc_stopSaving(); - Common.UI.warning({ - closable: false, - width: 500, - title: this.notcriticalErrorTitle, - msg: this.leavePageTextOnClose, - buttons: ['ok', 'cancel'], - primary: 'ok', - callback: function(btn) { - if (btn == 'ok') { - me.api.asc_undoAllChanges(); - Common.Gateway.requestClose(); - // Common.Controllers.Desktop.requestClose(); - } else - me.api.asc_continueSaving(); - } - }); - } else { - Common.Gateway.requestClose(); - // Common.Controllers.Desktop.requestClose(); - } + me.onRequestClose(); } else { var href = me.appOptions.customization.goback.url; if (!current && me.appOptions.customization.goback.blank!==false) { @@ -944,6 +949,7 @@ define([ Common.Gateway.on('processmouse', _.bind(me.onProcessMouse, me)); Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me)); Common.Gateway.on('setfavorite', _.bind(me.onSetFavorite, me)); + Common.Gateway.on('requestclose', _.bind(me.onRequestClose, me)); Common.Gateway.sendInfo({mode:me.appOptions.isEdit?'edit':'view'}); $(document).on('contextmenu', _.bind(me.onContextMenu, me)); diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index 1c6d2d289..7d7d6de1f 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -362,6 +362,10 @@ define([ this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.XLSX, true)); }, + onRequestClose: function() { + Common.Gateway.requestClose(); + }, + goBack: function(current) { if (this.appOptions.customization.goback.requestClose && this.appOptions.canRequestClose) { Common.Gateway.requestClose(); @@ -600,6 +604,7 @@ define([ Common.Gateway.on('processsaveresult', _.bind(me.onProcessSaveResult, me)); Common.Gateway.on('processrightschange', _.bind(me.onProcessRightsChange, me)); Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me)); + Common.Gateway.on('requestclose', _.bind(me.onRequestClose, me)); Common.Gateway.sendInfo({ mode: me.appOptions.isEdit ? 'edit' : 'view' From 22fc77c0a42a2700afc7aa10ef3799fd271fe115 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 29 Mar 2021 16:41:49 +0300 Subject: [PATCH 3/3] Fix closing editors --- apps/documenteditor/main/app/controller/Main.js | 1 + apps/presentationeditor/main/app/controller/Main.js | 1 + apps/spreadsheeteditor/main/app/controller/Main.js | 1 + 3 files changed, 3 insertions(+) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 437e56794..e8e09f45a 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -720,6 +720,7 @@ define([ callback: function(btn) { if (btn == 'ok') { me.api.asc_undoAllChanges(); + me.api.asc_continueSaving(); Common.Gateway.requestClose(); // Common.Controllers.Desktop.requestClose(); } else diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 0781d002d..41b97aeb5 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -499,6 +499,7 @@ define([ callback: function(btn) { if (btn == 'ok') { me.api.asc_undoAllChanges(); + me.api.asc_continueSaving(); Common.Gateway.requestClose(); // Common.Controllers.Desktop.requestClose(); } else diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 3e72bc703..cb9f5ad92 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -562,6 +562,7 @@ define([ callback: function(btn) { if (btn == 'ok') { me.api.asc_undoAllChanges(); + me.api.asc_continueSaving(); Common.Gateway.requestClose(); // Common.Controllers.Desktop.requestClose(); } else