From 511888dc4e1a631a1a88a202edc5dbd8fdbeefdd Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Tue, 16 Jul 2019 16:30:37 +0300 Subject: [PATCH] [all] opened 'create new' option for desktop app --- apps/common/main/lib/controller/Desktop.js | 6 ++++++ apps/documenteditor/main/app/controller/LeftMenu.js | 6 ++++-- apps/documenteditor/main/app/controller/Main.js | 2 +- apps/presentationeditor/main/app/controller/LeftMenu.js | 6 ++++-- apps/presentationeditor/main/app/controller/Main.js | 2 +- apps/presentationeditor/main/app/view/FileMenu.js | 3 --- apps/spreadsheeteditor/main/app/controller/LeftMenu.js | 6 ++++-- apps/spreadsheeteditor/main/app/controller/Main.js | 2 +- 8 files changed, 21 insertions(+), 12 deletions(-) diff --git a/apps/common/main/lib/controller/Desktop.js b/apps/common/main/lib/controller/Desktop.js index 17408b32e..ba7bd7336 100644 --- a/apps/common/main/lib/controller/Desktop.js +++ b/apps/common/main/lib/controller/Desktop.js @@ -125,6 +125,12 @@ define([ if ( opts == 'preloader:hide' ) { app.execCommand('editor:onready', ''); return true; + } else + if ( opts == 'create:new' ) { + if (config.createUrl == 'desktop://create.new') { + app.LocalFileCreate(!!window.SSE ? 2 : !!window.PE ? 1 : 0); + return true; + } } } diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index c7b99a405..fb82b1432 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -436,8 +436,10 @@ define([ }, onCreateNew: function(menu, type) { - var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank"); - if (newDocumentPage) newDocumentPage.focus(); + if ( !Common.Controllers.Desktop.process('create:new') ) { + var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank"); + if (newDocumentPage) newDocumentPage.focus(); + } if (menu) { menu.hide(); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 527957739..28b0d65d7 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -329,7 +329,7 @@ define([ this.editorConfig.user = this.appOptions.user = Common.Utils.fillUserInfo(this.editorConfig.user, this.editorConfig.lang, this.textAnonymous); this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop'; - this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl) && !this.appOptions.isDesktopApp; + this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl); this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp; this.appOptions.templates = this.editorConfig.templates; this.appOptions.recent = this.editorConfig.recent; diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index 69d667e48..d38358c8d 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -327,8 +327,10 @@ define([ }, onCreateNew: function(menu, type) { - var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank"); - if (newDocumentPage) newDocumentPage.focus(); + if ( !Common.Controllers.Desktop.process('create:new') ) { + var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank"); + if (newDocumentPage) newDocumentPage.focus(); + } if (menu) { menu.hide(); } diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 816054129..a16b70921 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -299,7 +299,7 @@ define([ this.editorConfig.user = this.appOptions.user = Common.Utils.fillUserInfo(data.config.user, this.editorConfig.lang, this.textAnonymous); this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop'; - this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl) && !this.appOptions.isDesktopApp; + this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl); this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp; this.appOptions.templates = this.editorConfig.templates; this.appOptions.recent = this.editorConfig.recent; diff --git a/apps/presentationeditor/main/app/view/FileMenu.js b/apps/presentationeditor/main/app/view/FileMenu.js index 9e4eafa87..4cc11dc79 100644 --- a/apps/presentationeditor/main/app/view/FileMenu.js +++ b/apps/presentationeditor/main/app/view/FileMenu.js @@ -292,9 +292,6 @@ define([ } } - if (this.mode.isDesktopApp && this.mode.isOffline) - this.$el.find('#fm-btn-create, #fm-btn-back, #fm-btn-create+.devider').hide(); - if (this.mode.canProtect) { this.panels['protect'] = (new PE.Views.FileMenuPanels.ProtectDoc({menu:this})).render(); this.panels['protect'].setMode(this.mode); diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index 4b25fd9bb..596a68398 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -385,8 +385,10 @@ define([ }, onCreateNew: function(menu, type) { - var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank"); - if (newDocumentPage) newDocumentPage.focus(); + if ( !Common.Controllers.Desktop.process('create:new') ) { + var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank"); + if (newDocumentPage) newDocumentPage.focus(); + } if (menu) { menu.hide(); } diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 9b9b92b42..b07853775 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -301,7 +301,7 @@ define([ this.editorConfig.user = this.appOptions.user = Common.Utils.fillUserInfo(this.editorConfig.user, this.editorConfig.lang, this.textAnonymous); this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop'; - this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl) && !this.appOptions.isDesktopApp; + this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl); this.appOptions.canOpenRecent = this.editorConfig.recent !== undefined && !this.appOptions.isDesktopApp; this.appOptions.templates = this.editorConfig.templates; this.appOptions.recent = this.editorConfig.recent;