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 @@
+