From b7a7d333c32f9533c772de771d1e0dba8a0beb49 Mon Sep 17 00:00:00 2001 From: Konstantin Kireyev Date: Thu, 13 Jun 2024 13:11:23 +0500 Subject: [PATCH] fix/pe: minimal post load bootable version --- .../main/app/controller/DocumentHolder.js | 99 ++++++++++--------- .../main/app/controller/LeftMenu.js | 1 - .../main/app/controller/Main.js | 2 - .../main/app/controller/Toolbar.js | 6 -- .../main/app/view/DateTimeDialog.js | 3 +- .../main/app/view/DocumentHolder.js | 1 - .../main/app/view/FileMenuPanels.js | 2 - .../main/app/view/ImageSettings.js | 3 +- .../main/app/view/ImageSettingsAdvanced.js | 6 +- .../app/view/ParagraphSettingsAdvanced.js | 8 +- .../main/app/view/ShapeSettings.js | 3 +- .../main/app/view/ShapeSettingsAdvanced.js | 8 +- .../main/app/view/SlideSettings.js | 3 +- .../main/app/view/TableSettings.js | 1 - .../main/app/view/TableSettingsAdvanced.js | 5 +- .../main/app/view/TextArtSettings.js | 3 +- apps/presentationeditor/main/app_dev.js | 15 +++ apps/presentationeditor/main/app_pack.js | 24 +++++ build/presentationeditor.json | 14 +++ 19 files changed, 119 insertions(+), 88 deletions(-) create mode 100644 apps/presentationeditor/main/app_pack.js diff --git a/apps/presentationeditor/main/app/controller/DocumentHolder.js b/apps/presentationeditor/main/app/controller/DocumentHolder.js index 2e83563fdf..b93958e984 100644 --- a/apps/presentationeditor/main/app/controller/DocumentHolder.js +++ b/apps/presentationeditor/main/app/controller/DocumentHolder.js @@ -159,6 +159,7 @@ define([ Common.util.Shortcuts.delegateShortcuts({shortcuts:keymap}); Common.Utils.InternalSettings.set('pe-equation-toolbar-hide', Common.localStorage.getBool('pe-equation-toolbar-hide')); + Common.NotificationCenter.on('script:loaded', _.bind(me.createPostLoadElements, me)); }, onLaunch: function() { @@ -333,52 +334,6 @@ define([ return; } - var diagramEditor = this.getApplication().getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor'); - if (diagramEditor) { - diagramEditor.on('internalmessage', _.bind(function(cmp, message) { - var command = message.data.command; - var data = message.data.data; - if (this.api) { - ( diagramEditor.isEditMode() ) - ? this.api.asc_editChartDrawingObject(data) - : this.api.asc_addChartDrawingObject(data, diagramEditor.getPlaceholder()); - } - }, this)); - diagramEditor.on('hide', _.bind(function(cmp, message) { - if (this.api) { - this.api.asc_onCloseChartFrame(); - this.api.asc_enableKeyEvents(true); - } - var me = this; - setTimeout(function(){ - me.editComplete(); - }, 10); - }, this)); - } - - var oleEditor = this.getApplication().getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor'); - if (oleEditor) { - oleEditor.on('internalmessage', _.bind(function(cmp, message) { - var command = message.data.command; - var data = message.data.data; - if (this.api) { - oleEditor.isEditMode() - ? this.api.asc_editTableOleObject(data) - : this.api.asc_addTableOleObject(data); - } - }, this)); - oleEditor.on('hide', _.bind(function(cmp, message) { - if (this.api) { - this.api.asc_enableKeyEvents(true); - this.api.asc_onCloseChartFrame(); - } - var me = this; - setTimeout(function(){ - me.editComplete(); - }, 10); - }, this)); - } - view.menuSlidePaste.on('click', _.bind(me.onCutCopyPaste, me)); view.menuParaCopy.on('click', _.bind(me.onCutCopyPaste, me)); view.menuParaPaste.on('click', _.bind(me.onCutCopyPaste, me)); @@ -459,6 +414,58 @@ define([ view.menuParagraphEquation.menu.on('item:click', _.bind(me.convertEquation, me)); }, + createPostLoadElements: function() { + if (this.type !== 'edit') { + return; + } + + var diagramEditor = this.getApplication().getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor'); + if (diagramEditor) { + diagramEditor.on('internalmessage', _.bind(function(cmp, message) { + var command = message.data.command; + var data = message.data.data; + if (this.api) { + ( diagramEditor.isEditMode() ) + ? this.api.asc_editChartDrawingObject(data) + : this.api.asc_addChartDrawingObject(data, diagramEditor.getPlaceholder()); + } + }, this)); + diagramEditor.on('hide', _.bind(function(cmp, message) { + if (this.api) { + this.api.asc_onCloseChartFrame(); + this.api.asc_enableKeyEvents(true); + } + var me = this; + setTimeout(function(){ + me.editComplete(); + }, 10); + }, this)); + } + + var oleEditor = this.getApplication().getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor'); + if (oleEditor) { + oleEditor.on('internalmessage', _.bind(function(cmp, message) { + var command = message.data.command; + var data = message.data.data; + if (this.api) { + oleEditor.isEditMode() + ? this.api.asc_editTableOleObject(data) + : this.api.asc_addTableOleObject(data); + } + }, this)); + oleEditor.on('hide', _.bind(function(cmp, message) { + if (this.api) { + this.api.asc_enableKeyEvents(true); + this.api.asc_onCloseChartFrame(); + } + var me = this; + setTimeout(function(){ + me.editComplete(); + }, 10); + }, this)); + } + }, + getView: function (name) { return !name ? this.documentHolder : Backbone.Controller.prototype.getView.call() diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index 607b452ab9..759ca36130 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -42,7 +42,6 @@ define([ 'core', 'common/main/lib/util/Shortcuts', - 'common/main/lib/view/SaveAsDlg', 'presentationeditor/main/app/view/LeftMenu', 'presentationeditor/main/app/view/FileMenu' ], function () { diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index c44be64501..98f6ac32f0 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -47,8 +47,6 @@ define([ 'common/main/lib/component/Tooltip', 'common/main/lib/controller/Fonts', 'common/main/lib/collection/TextArt', - 'common/main/lib/view/OpenDialog', - 'common/main/lib/view/UserNameDialog', 'common/main/lib/util/LocalStorage', 'presentationeditor/main/app/collection/ShapeGroups', 'presentationeditor/main/app/collection/SlideLayouts', diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 91d17af381..023fef4127 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -43,12 +43,6 @@ define([ 'core', 'common/main/lib/component/Window', - 'common/main/lib/view/CopyWarningDialog', - 'common/main/lib/view/ImageFromUrlDialog', - 'common/main/lib/view/InsertTableDialog', - 'common/main/lib/view/SelectFileDlg', - 'common/main/lib/view/ListSettingsDialog', - 'common/main/lib/view/SymbolTableDialog', 'common/main/lib/util/define', 'presentationeditor/main/app/collection/SlideThemes', 'presentationeditor/main/app/controller/Transitions', diff --git a/apps/presentationeditor/main/app/view/DateTimeDialog.js b/apps/presentationeditor/main/app/view/DateTimeDialog.js index 7909b0c97d..d52416369c 100644 --- a/apps/presentationeditor/main/app/view/DateTimeDialog.js +++ b/apps/presentationeditor/main/app/view/DateTimeDialog.js @@ -39,8 +39,7 @@ define([ 'common/main/lib/component/Window', - 'common/main/lib/component/ComboBox', - 'common/main/lib/component/ListView' + 'common/main/lib/component/ComboBox' ], function () { 'use strict'; diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index b6b4e07c57..e9f4de6973 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -36,7 +36,6 @@ define([ 'gateway', 'common/main/lib/util/utils', 'common/main/lib/component/Menu', - 'common/main/lib/view/CopyWarningDialog', 'presentationeditor/main/app/view/HyperlinkSettingsDialog', // 'common/main/lib/view/InsertTableDialog', ], function ($, _, Backbone, gateway) { 'use strict'; diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index 02f576ff75..0b1444befd 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -40,8 +40,6 @@ */ define([ - 'common/main/lib/view/DocumentAccessDialog', - 'common/main/lib/view/AutoCorrectDialog', 'common/main/lib/component/CheckBox' ], function () { 'use strict'; diff --git a/apps/presentationeditor/main/app/view/ImageSettings.js b/apps/presentationeditor/main/app/view/ImageSettings.js index 9885382cb6..4e709c41e9 100644 --- a/apps/presentationeditor/main/app/view/ImageSettings.js +++ b/apps/presentationeditor/main/app/view/ImageSettings.js @@ -42,8 +42,7 @@ define([ 'jquery', 'underscore', 'backbone', - 'common/main/lib/component/Button', - 'common/main/lib/view/ImageFromUrlDialog', + 'common/main/lib/component/Button' ], function (menuTemplate, $, _, Backbone) { 'use strict'; diff --git a/apps/presentationeditor/main/app/view/ImageSettingsAdvanced.js b/apps/presentationeditor/main/app/view/ImageSettingsAdvanced.js index 1ceace1d3f..73350079e5 100644 --- a/apps/presentationeditor/main/app/view/ImageSettingsAdvanced.js +++ b/apps/presentationeditor/main/app/view/ImageSettingsAdvanced.js @@ -37,10 +37,8 @@ * */ -define([ 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.template', - 'common/main/lib/view/AdvancedSettingsWindow', - 'common/main/lib/component/MetricSpinner', - 'common/main/lib/component/CheckBox' +define([ + 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.template' ], function (contentTemplate) { 'use strict'; diff --git a/apps/presentationeditor/main/app/view/ParagraphSettingsAdvanced.js b/apps/presentationeditor/main/app/view/ParagraphSettingsAdvanced.js index bc34126592..ed7f6a6737 100644 --- a/apps/presentationeditor/main/app/view/ParagraphSettingsAdvanced.js +++ b/apps/presentationeditor/main/app/view/ParagraphSettingsAdvanced.js @@ -37,12 +37,8 @@ * */ -define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced.template', - 'common/main/lib/view/AdvancedSettingsWindow', - 'common/main/lib/component/MetricSpinner', - 'common/main/lib/component/CheckBox', - 'common/main/lib/component/RadioBox', - 'common/main/lib/component/ListView' +define([ + 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced.template' ], function (contentTemplate) { 'use strict'; diff --git a/apps/presentationeditor/main/app/view/ShapeSettings.js b/apps/presentationeditor/main/app/view/ShapeSettings.js index 1ddd4620dd..403fd7ea88 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettings.js +++ b/apps/presentationeditor/main/app/view/ShapeSettings.js @@ -49,8 +49,7 @@ define([ 'common/main/lib/component/ColorButton', 'common/main/lib/component/ComboDataView', 'common/main/lib/component/Slider', - 'common/main/lib/component/MultiSliderGradient', - 'common/main/lib/view/ImageFromUrlDialog', + 'common/main/lib/component/MultiSliderGradient' ], function (menuTemplate, $, _, Backbone) { 'use strict'; diff --git a/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js b/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js index 57d786013c..5b5229b16e 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js +++ b/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js @@ -37,12 +37,8 @@ * */ -define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.template', - 'common/main/lib/view/AdvancedSettingsWindow', - 'common/main/lib/component/ComboBox', - 'common/main/lib/component/MetricSpinner', - 'common/main/lib/component/CheckBox', - 'common/main/lib/component/ComboBoxDataView' +define([ + 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.template' ], function (contentTemplate) { 'use strict'; diff --git a/apps/presentationeditor/main/app/view/SlideSettings.js b/apps/presentationeditor/main/app/view/SlideSettings.js index 88de30aa84..fbebea1864 100644 --- a/apps/presentationeditor/main/app/view/SlideSettings.js +++ b/apps/presentationeditor/main/app/view/SlideSettings.js @@ -47,8 +47,7 @@ define([ 'common/main/lib/component/ThemeColorPalette', 'common/main/lib/component/ColorButton', 'common/main/lib/component/ComboDataView', - 'common/main/lib/component/MultiSliderGradient', - 'common/main/lib/view/ImageFromUrlDialog' + 'common/main/lib/component/MultiSliderGradient' ], function (menuTemplate, $, _, Backbone) { 'use strict'; diff --git a/apps/presentationeditor/main/app/view/TableSettings.js b/apps/presentationeditor/main/app/view/TableSettings.js index fc5ccea699..c9c7edf872 100644 --- a/apps/presentationeditor/main/app/view/TableSettings.js +++ b/apps/presentationeditor/main/app/view/TableSettings.js @@ -48,7 +48,6 @@ define([ 'common/main/lib/component/ColorButton', 'common/main/lib/component/ComboBorderSize', 'common/main/lib/component/ComboDataView', - 'common/main/lib/view/InsertTableDialog', ], function (menuTemplate, $, _, Backbone) { 'use strict'; diff --git a/apps/presentationeditor/main/app/view/TableSettingsAdvanced.js b/apps/presentationeditor/main/app/view/TableSettingsAdvanced.js index a29c825d05..cef996b5c0 100644 --- a/apps/presentationeditor/main/app/view/TableSettingsAdvanced.js +++ b/apps/presentationeditor/main/app/view/TableSettingsAdvanced.js @@ -37,9 +37,8 @@ * */ -define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.template', - 'common/main/lib/view/AdvancedSettingsWindow', - 'common/main/lib/component/MetricSpinner' +define([ + 'text!presentationeditor/main/app/template/TableSettingsAdvanced.template' ], function (contentTemplate) { 'use strict'; diff --git a/apps/presentationeditor/main/app/view/TextArtSettings.js b/apps/presentationeditor/main/app/view/TextArtSettings.js index 86e5062533..186300a943 100644 --- a/apps/presentationeditor/main/app/view/TextArtSettings.js +++ b/apps/presentationeditor/main/app/view/TextArtSettings.js @@ -49,8 +49,7 @@ define([ 'common/main/lib/component/ColorButton', 'common/main/lib/component/ComboDataView', 'common/main/lib/component/Slider', - 'common/main/lib/component/MultiSliderGradient', - 'common/main/lib/view/ImageFromUrlDialog' + 'common/main/lib/component/MultiSliderGradient' ], function (menuTemplate, $, _, Backbone) { 'use strict'; diff --git a/apps/presentationeditor/main/app_dev.js b/apps/presentationeditor/main/app_dev.js index 30a70e2808..5af756e96b 100644 --- a/apps/presentationeditor/main/app_dev.js +++ b/apps/presentationeditor/main/app_dev.js @@ -202,6 +202,21 @@ require([ ], function() { app.postLaunchScripts = [ 'common/main/lib/controller/ScreenReaderFocus', + 'common/main/lib/component/ListView', + 'common/main/lib/view/AdvancedSettingsWindow', + 'common/main/lib/view/AutoCorrectDialog', + 'common/main/lib/view/DocumentAccessDialog', + 'common/main/lib/view/UserNameDialog', + 'common/main/lib/view/SaveAsDlg', + 'common/main/lib/view/CopyWarningDialog', + 'common/main/lib/view/ImageFromUrlDialog', + 'common/main/lib/view/SelectFileDlg', + 'common/main/lib/view/SymbolTableDialog', + 'common/main/lib/view/OpenDialog', + 'common/main/lib/view/ExternalEditor', + 'common/main/lib/view/ExternalDiagramEditor', + 'common/main/lib/view/ExternalOleEditor', + 'presentationeditor/main/app/view/ParagraphSettingsAdvanced', 'presentationeditor/main/app/view/ShapeSettingsAdvanced', 'presentationeditor/main/app/view/TableSettingsAdvanced', diff --git a/apps/presentationeditor/main/app_pack.js b/apps/presentationeditor/main/app_pack.js new file mode 100644 index 0000000000..5242475d6c --- /dev/null +++ b/apps/presentationeditor/main/app_pack.js @@ -0,0 +1,24 @@ +require([ + 'common/main/lib/controller/ScreenReaderFocus', + 'common/main/lib/component/ListView', + 'common/main/lib/view/AdvancedSettingsWindow', + 'common/main/lib/view/AutoCorrectDialog', + 'common/main/lib/view/DocumentAccessDialog', + 'common/main/lib/view/UserNameDialog', + 'common/main/lib/view/SaveAsDlg', + 'common/main/lib/view/CopyWarningDialog', + 'common/main/lib/view/ImageFromUrlDialog', + 'common/main/lib/view/SelectFileDlg', + 'common/main/lib/view/SymbolTableDialog', + 'common/main/lib/view/OpenDialog', + 'common/main/lib/view/ExternalEditor', + 'common/main/lib/view/ExternalDiagramEditor', + 'common/main/lib/view/ExternalOleEditor', + + 'presentationeditor/main/app/view/ParagraphSettingsAdvanced', + 'presentationeditor/main/app/view/ShapeSettingsAdvanced', + 'presentationeditor/main/app/view/TableSettingsAdvanced', + 'presentationeditor/main/app/view/ImageSettingsAdvanced', +], function () { + Common.NotificationCenter.trigger('script:loaded'); +}); \ No newline at end of file diff --git a/build/presentationeditor.json b/build/presentationeditor.json index a93244d89a..7a040743ff 100644 --- a/build/presentationeditor.json +++ b/build/presentationeditor.json @@ -98,6 +98,20 @@ } } } + }, + "postload": { + "options": { + "baseUrl": "../apps/", + "optimize": "none", + "name": "../apps/presentationeditor/main/app_pack.js", + "out": "../deploy/web-apps/apps/presentationeditor/main/code.js", + "inlineText": true, + "findNestedDependencies": false, + "optimizeAllPluginResources": false, + "paths": { + "text": "../vendor/requirejs-text/text" + } + } } }, "less": {