From 6fe2adf8fd94ed66c074d4689ab07df98adaff64 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Wed, 25 May 2022 16:48:17 +0300 Subject: [PATCH] [desktop] refactoring --- apps/common/main/lib/component/ComboBoxFonts.js | 3 +-- apps/documenteditor/main/app/controller/Main.js | 2 +- apps/documenteditor/main/app/view/FileMenu.js | 2 +- apps/presentationeditor/main/app/controller/Main.js | 2 +- apps/presentationeditor/main/app/view/FileMenu.js | 2 +- apps/presentationeditor/main/app/view/Toolbar.js | 4 +++- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/common/main/lib/component/ComboBoxFonts.js b/apps/common/main/lib/component/ComboBoxFonts.js index 2ef4f3150..0246c3f34 100644 --- a/apps/common/main/lib/component/ComboBoxFonts.js +++ b/apps/common/main/lib/component/ComboBoxFonts.js @@ -89,7 +89,7 @@ define([ thumbCanvas.width = thumbs[thumbIdx].width; function CThumbnailLoader() { - this.supportBinaryFormat = (window['AscDesktopEditor'] && !window['AscDesktopEditor']['isSupportBinaryFontsSprite']) ? false : true; + this.supportBinaryFormat = !(Common.Controllers.Desktop.isActive() && !Common.Controllers.isFeatureAvailable('isSupportBinaryFontsSprite')); this.image = null; this.binaryFormat = null; @@ -132,7 +132,6 @@ define([ }; this.openBinary = function(arrayBuffer) { - //var t1 = performance.now(); var binaryAlpha = new Uint8Array(arrayBuffer); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index df0b12c17..b266becf9 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1201,7 +1201,7 @@ define([ Common.Utils.InternalSettings.set("de-settings-showsnaplines", me.api.get_ShowSnapLines()); function checkWarns() { - if (!window['AscDesktopEditor']) { + if (!Common.Controllers.Desktop.isActive()) { var tips = []; Common.Utils.isIE9m && tips.push(me.warnBrowserIE9); diff --git a/apps/documenteditor/main/app/view/FileMenu.js b/apps/documenteditor/main/app/view/FileMenu.js index 041fb9795..a448032aa 100644 --- a/apps/documenteditor/main/app/view/FileMenu.js +++ b/apps/documenteditor/main/app/view/FileMenu.js @@ -368,7 +368,7 @@ define([ isVisible && (lastSeparator = this.miClose.$el.find('+.devider')); this.miDownload[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide'](); - var isBCSupport = window["AscDesktopEditor"] ? window["AscDesktopEditor"]["isBlockchainSupport"]() : false; + var isBCSupport = Common.Controllers.Desktop.isActive() ? Common.Controllers.Desktop.call("isBlockchainSupport") : false; this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) && !isBCSupport ?'show':'hide'](); this.miSaveAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide'](); this.miSave[this.mode.isEdit && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') ?'show':'hide'](); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 98f36fc38..10b7f09e3 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -826,7 +826,7 @@ define([ me.api.asc_ShowNotes(!value); function checkWarns() { - if (!window['AscDesktopEditor']) { + if (!Common.Controllers.Desktop.isActive()) { var tips = []; Common.Utils.isIE9m && tips.push(me.warnBrowserIE9); diff --git a/apps/presentationeditor/main/app/view/FileMenu.js b/apps/presentationeditor/main/app/view/FileMenu.js index c03f8c44b..65bb5a394 100644 --- a/apps/presentationeditor/main/app/view/FileMenu.js +++ b/apps/presentationeditor/main/app/view/FileMenu.js @@ -369,7 +369,7 @@ define([ isVisible && (lastSeparator = this.miClose.$el.find('+.devider')); this.miDownload[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide'](); - var isBCSupport = window["AscDesktopEditor"] ? window["AscDesktopEditor"]["isBlockchainSupport"]() : false; + var isBCSupport = Common.Controllers.Desktop.isActive() ? Common.Controllers.Desktop.call("isBlockchainSupport") : false; this.miSaveCopyAs[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) && !isBCSupport ?'show':'hide'](); this.miSaveAs[(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide'](); this.miSave[this.mode.isEdit && Common.UI.LayoutManager.isElementVisible('toolbar-file-save') ?'show':'hide'](); diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 42006a9c2..1e7558d0e 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -833,7 +833,9 @@ define([ }); me.slideOnlyControls.push(me.btnInsSlideNum); - if (window["AscDesktopEditor"] && window["AscDesktopEditor"]["IsSupportMedia"] && window["AscDesktopEditor"]["IsSupportMedia"]()) { + if (Common.Controllers.Desktop.isActive() && + Common.Controllers.Desktop.isFeatureAvailable("IsSupportMedia") && Common.Controllers.Desktop.call("IsSupportMedia")) + { me.btnInsAudio = new Common.UI.Button({ id: 'tlbtn-insaudio', cls: 'btn-toolbar x-huge icon-top',