From 0add97dac751a29629e9d660182305088fb39b5f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 18 Mar 2024 15:21:17 +0300 Subject: [PATCH 1/2] Fix close button in the editor header --- apps/documenteditor/embed/js/ApplicationController.js | 2 +- apps/documenteditor/main/app/controller/Main.js | 2 +- apps/pdfeditor/main/app/controller/Main.js | 2 +- apps/presentationeditor/embed/js/ApplicationController.js | 2 +- apps/presentationeditor/main/app/controller/Main.js | 2 +- apps/spreadsheeteditor/embed/js/ApplicationController.js | 2 +- apps/spreadsheeteditor/main/app/controller/Main.js | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index 7a9e4cb810..da168bb749 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -100,7 +100,7 @@ DE.ApplicationController = new(function(){ if (config.customization.goback.requestClose) console.log("Obsolete: The 'requestClose' parameter of the 'customization.goback' section is deprecated. Please use 'close' parameter in the 'customization' section instead."); } - if (typeof config.customization.close === 'object') + if (config.customization.close && typeof config.customization.close === 'object') config.canCloseEditor = (config.customization.close.visible!==false) && config.canRequestClose && !config.isDesktopApp; } config.canBackToFolder = !!_canback; diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 62023a56ee..3bd7c86522 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -480,7 +480,7 @@ define([ if (this.appOptions.customization.goback.requestClose) console.log("Obsolete: The 'requestClose' parameter of the 'customization.goback' section is deprecated. Please use 'close' parameter in the 'customization' section instead."); } - if (typeof this.appOptions.customization.close === 'object') + if (this.appOptions.customization.close && typeof this.appOptions.customization.close === 'object') // if close=null - no close button this.appOptions.canCloseEditor = (this.appOptions.customization.close.visible!==false) && this.appOptions.canRequestClose && !this.appOptions.isDesktopApp; } this.appOptions.canBack = this.appOptions.canBackToFolder = !!_canback; diff --git a/apps/pdfeditor/main/app/controller/Main.js b/apps/pdfeditor/main/app/controller/Main.js index 5efa1a0dc8..f7fe5c0fc3 100644 --- a/apps/pdfeditor/main/app/controller/Main.js +++ b/apps/pdfeditor/main/app/controller/Main.js @@ -417,7 +417,7 @@ define([ if (this.appOptions.customization.goback.requestClose) console.log("Obsolete: The 'requestClose' parameter of the 'customization.goback' section is deprecated. Please use 'close' parameter in the 'customization' section instead."); } - if (typeof this.appOptions.customization.close === 'object') + if (this.appOptions.customization.close && typeof this.appOptions.customization.close === 'object') this.appOptions.canCloseEditor = (this.appOptions.customization.close.visible!==false) && this.appOptions.canRequestClose && !this.appOptions.isDesktopApp; } this.appOptions.canBack = this.appOptions.canBackToFolder = !!_canback; diff --git a/apps/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index a69f279975..0a89aca7e9 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -97,7 +97,7 @@ PE.ApplicationController = new(function(){ if (config.customization.goback.requestClose) console.log("Obsolete: The 'requestClose' parameter of the 'customization.goback' section is deprecated. Please use 'close' parameter in the 'customization' section instead."); } - if (typeof config.customization.close === 'object') + if (config.customization.close && typeof config.customization.close === 'object') config.canCloseEditor = (config.customization.close.visible!==false) && config.canRequestClose && !config.isDesktopApp; } config.canBackToFolder = !!_canback; diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index cc0a20cc64..4a69b24422 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -428,7 +428,7 @@ define([ if (this.appOptions.customization.goback.requestClose) console.log("Obsolete: The 'requestClose' parameter of the 'customization.goback' section is deprecated. Please use 'close' parameter in the 'customization' section instead."); } - if (typeof this.appOptions.customization.close === 'object') + if (this.appOptions.customization.close && typeof this.appOptions.customization.close === 'object') this.appOptions.canCloseEditor = (this.appOptions.customization.close.visible!==false) && this.appOptions.canRequestClose && !this.appOptions.isDesktopApp; } this.appOptions.canBack = this.appOptions.canBackToFolder = !!_canback; diff --git a/apps/spreadsheeteditor/embed/js/ApplicationController.js b/apps/spreadsheeteditor/embed/js/ApplicationController.js index 8fa6ad95c1..935e6c98c8 100644 --- a/apps/spreadsheeteditor/embed/js/ApplicationController.js +++ b/apps/spreadsheeteditor/embed/js/ApplicationController.js @@ -97,7 +97,7 @@ SSE.ApplicationController = new(function(){ if (config.customization.goback.requestClose) console.log("Obsolete: The 'requestClose' parameter of the 'customization.goback' section is deprecated. Please use 'close' parameter in the 'customization' section instead."); } - if (typeof config.customization.close === 'object') + if (config.customization.close && typeof config.customization.close === 'object') config.canCloseEditor = (config.customization.close.visible!==false) && config.canRequestClose && !config.isDesktopApp; } config.canBackToFolder = !!_canback; diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 041cbdd066..f3c60b9176 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -484,7 +484,7 @@ define([ if (this.appOptions.customization.goback.requestClose) console.log("Obsolete: The 'requestClose' parameter of the 'customization.goback' section is deprecated. Please use 'close' parameter in the 'customization' section instead."); } - if (typeof this.appOptions.customization.close === 'object') + if (this.appOptions.customization.close && typeof this.appOptions.customization.close === 'object') this.appOptions.canCloseEditor = (this.appOptions.customization.close.visible!==false) && this.appOptions.canRequestClose && !this.appOptions.isDesktopApp; } this.appOptions.canBack = this.appOptions.canBackToFolder = !!_canback; From 8c8b63286b406ce7432350f7f449449c480314dd Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 18 Mar 2024 15:29:05 +0300 Subject: [PATCH 2/2] [Forms] Add close button to forms editor --- .../app/controller/ApplicationController.js | 24 +++++++++++++++++++ .../forms/app/view/ApplicationView.js | 12 +++++++++- apps/documenteditor/forms/index.html | 1 + apps/documenteditor/forms/index.html.deploy | 1 + apps/documenteditor/forms/locale/en.json | 3 ++- 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index 727d0ab231..1753042155 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -473,6 +473,22 @@ define([ this.appOptions.canPlugins = false; Common.Controllers.Desktop.init(this.appOptions); + + this.appOptions.canCloseEditor = false; + var _canback = false; + if (typeof this.appOptions.customization === 'object') { + if (typeof this.appOptions.customization.goback == 'object' && this.appOptions.canBackToFolder!==false) { + _canback = this.appOptions.customization.close===undefined ? + this.appOptions.customization.goback.url || this.appOptions.customization.goback.requestClose && this.appOptions.canRequestClose : + this.appOptions.customization.goback.url && !this.appOptions.customization.goback.requestClose; + + if (this.appOptions.customization.goback.requestClose) + console.log("Obsolete: The 'requestClose' parameter of the 'customization.goback' section is deprecated. Please use 'close' parameter in the 'customization' section instead."); + } + if (this.appOptions.customization.close && typeof this.appOptions.customization.close === 'object') + this.appOptions.canCloseEditor = (this.appOptions.customization.close.visible!==false) && this.appOptions.canRequestClose && !this.appOptions.isDesktopApp; + } + this.appOptions.canBackToFolder = !!_canback; }, onExternalMessage: function(msg) { @@ -675,6 +691,14 @@ define([ this.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None); } + this.view.btnClose.setVisible(this.appOptions.canCloseEditor); + if (this.appOptions.canCloseEditor) { + this.view.btnClose.updateHint(this.appOptions.customization.close.text || this.view.textClose); + this.view.btnClose.on('click', function(){ + Common.Gateway.requestClose(); + }); + } + this.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); this.api.asc_LoadDocument(); this.api.Resize(); diff --git a/apps/documenteditor/forms/app/view/ApplicationView.js b/apps/documenteditor/forms/app/view/ApplicationView.js index 9024122428..8c2d200d72 100644 --- a/apps/documenteditor/forms/app/view/ApplicationView.js +++ b/apps/documenteditor/forms/app/view/ApplicationView.js @@ -169,6 +169,15 @@ define([ maskExp: /[0-9]/ }); + this.btnClose = new Common.UI.Button({ + cls: 'btn-toolbar margin-left-small', + iconCls: 'svg-icon search-close', + hint: this.textClose, + visible: false, + scaling: false + }); + this.btnClose.render($('#id-btn-close-editor')); + return this; }, @@ -213,7 +222,8 @@ define([ txtSearch: 'Search', tipUndo: 'Undo', tipRedo: 'Redo', - textClearField: 'Clear field' + textClearField: 'Clear field', + textClose: 'Close file' }, DE.Views.ApplicationView || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/forms/index.html b/apps/documenteditor/forms/index.html index 779119866f..6f8bfee27f 100644 --- a/apps/documenteditor/forms/index.html +++ b/apps/documenteditor/forms/index.html @@ -278,6 +278,7 @@
+
diff --git a/apps/documenteditor/forms/index.html.deploy b/apps/documenteditor/forms/index.html.deploy index ba1fd4a9f8..e4d0bad839 100644 --- a/apps/documenteditor/forms/index.html.deploy +++ b/apps/documenteditor/forms/index.html.deploy @@ -259,6 +259,7 @@
+