From 45a9058da461a9da67ccb389faad08bce8cbda55 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Fri, 16 Apr 2021 19:03:30 +0300 Subject: [PATCH] [DE PE mobile] Changes for private branch --- .../mobile/src/controller/ContextMenu.jsx | 4 +-- .../mobile/src/controller/Main.jsx | 25 ++++++------------- .../mobile/src/view/Toolbar.jsx | 4 +-- .../mobile/src/controller/ContextMenu.jsx | 4 +-- .../mobile/src/controller/Main.jsx | 21 ++++++---------- .../mobile/src/view/Toolbar.jsx | 4 +-- 6 files changed, 23 insertions(+), 39 deletions(-) diff --git a/apps/documenteditor/mobile/src/controller/ContextMenu.jsx b/apps/documenteditor/mobile/src/controller/ContextMenu.jsx index 978afa679..136679559 100644 --- a/apps/documenteditor/mobile/src/controller/ContextMenu.jsx +++ b/apps/documenteditor/mobile/src/controller/ContextMenu.jsx @@ -65,7 +65,7 @@ class ContextMenu extends ContextMenuController { onMenuItemClick(action) { super.onMenuItemClick(action); - if ( EditorUIController.ContextMenu.handleMenuItemClick(this, action) ) + if ( EditorUIController.ContextMenu && EditorUIController.ContextMenu.handleMenuItemClick(this, action) ) return; const api = Common.EditorApi.get(); @@ -205,7 +205,7 @@ class ContextMenu extends ContextMenuController { if ( !Common.EditorApi ) return []; const { isEdit } = this.props; - if (isEdit) { + if (isEdit && EditorUIController.ContextMenu) { return EditorUIController.ContextMenu.mapMenuItems(this); } else { const { t } = this.props; diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx index c08ce978b..061f1eae9 100644 --- a/apps/documenteditor/mobile/src/controller/Main.jsx +++ b/apps/documenteditor/mobile/src/controller/Main.jsx @@ -9,8 +9,6 @@ import {InitReviewController as ReviewController} from '../../../../common/mobil import { onAdvancedOptions } from './settings/Download.jsx'; import { CommentsController, - AddCommentController, - EditCommentController, ViewCommentsController } from "../../../../common/mobile/lib/controller/collaboration/Comments"; import About from '../../../../common/mobile/lib/view/About'; @@ -488,9 +486,7 @@ class MainController extends Component { this.api.asc_registerCallback('asc_onDocumentName', this.onDocumentName.bind(this)); this.api.asc_registerCallback('asc_onPrintUrl', this.onPrintUrl.bind(this)); - this.api.asc_registerCallback('asc_onSendThemeColors', (colors, standart_colors) => { - Common.Utils.ThemeColor.setColors(colors, standart_colors); - }); + EditorUIController.initThemeColors && EditorUIController.initThemeColors(); this.api.asc_registerCallback('asc_onDownloadUrl', this.onDownloadUrl.bind(this)); @@ -504,8 +500,8 @@ class MainController extends Component { //text settings const storeTextSettings = this.props.storeTextSettings; - EditorUIController.initFonts(storeTextSettings); - EditorUIController.initFocusObjects(this.props.storeFocusObjects); + EditorUIController.initFonts && EditorUIController.initFonts(storeTextSettings); + EditorUIController.initFocusObjects && EditorUIController.initFocusObjects(this.props.storeFocusObjects); this.api.asc_registerCallback('asc_onVerticalAlign', (typeBaseline) => { storeTextSettings.resetTypeBaseline(typeBaseline); @@ -543,19 +539,13 @@ class MainController extends Component { }); //paragraph settings - EditorUIController.initEditorStyles(this.props.storeParagraphSettings); + EditorUIController.initEditorStyles && EditorUIController.initEditorStyles(this.props.storeParagraphSettings); //table settings - EditorUIController.initTableTemplates(this.props.storeTableSettings); + EditorUIController.initTableTemplates && EditorUIController.initTableTemplates(this.props.storeTableSettings); //chart settings - const storeChartSettings = this.props.storeChartSettings; - const storeFocusObjects = this.props.storeFocusObjects; - this.api.asc_registerCallback('asc_onUpdateChartStyles', () => { - if (storeFocusObjects.chartObject && storeFocusObjects.chartObject.get_ChartProperties()) { - storeChartSettings.updateChartStyles(this.api.asc_getChartPreviews(storeFocusObjects.chartObject.get_ChartProperties().getType())); - } - }); + EditorUIController.updateChartStyles && EditorUIController.updateChartStyles(this.props.storeChartSettings, this.props.storeFocusObjects); // Document Info @@ -782,8 +772,7 @@ class MainController extends Component { - - + {EditorUIController.getEditCommentControllers && EditorUIController.getEditCommentControllers()} ) diff --git a/apps/documenteditor/mobile/src/view/Toolbar.jsx b/apps/documenteditor/mobile/src/view/Toolbar.jsx index d73db145c..6dd921194 100644 --- a/apps/documenteditor/mobile/src/view/Toolbar.jsx +++ b/apps/documenteditor/mobile/src/view/Toolbar.jsx @@ -9,7 +9,7 @@ const ToolbarView = props => { {props.isShowBack && } - {props.isEdit && EditorUIController.getUndoRedo({ + {props.isEdit && EditorUIController.getUndoRedo && EditorUIController.getUndoRedo({ disabledUndo: !props.isCanUndo, disabledRedo: !props.isCanRedo, onUndoClick: props.onUndo, @@ -18,7 +18,7 @@ const ToolbarView = props => { {!Device.phone && {props.docTitle}} - {props.isEdit && EditorUIController.getToolbarOptions({ + {props.isEdit && EditorUIController.getToolbarOptions && EditorUIController.getToolbarOptions({ disabled: disableEditBtn || props.disabledControls, onEditClick: e => props.openOptions('edit'), onAddClick: e => props.openOptions('add') diff --git a/apps/presentationeditor/mobile/src/controller/ContextMenu.jsx b/apps/presentationeditor/mobile/src/controller/ContextMenu.jsx index b4680f6a0..e72ce5d66 100644 --- a/apps/presentationeditor/mobile/src/controller/ContextMenu.jsx +++ b/apps/presentationeditor/mobile/src/controller/ContextMenu.jsx @@ -58,7 +58,7 @@ class ContextMenu extends ContextMenuController { onMenuItemClick(action) { super.onMenuItemClick(action); - if ( EditorUIController.ContextMenu.handleMenuItemClick(this, action) ) + if ( EditorUIController.ContextMenu && EditorUIController.ContextMenu.handleMenuItemClick(this, action) ) return; const api = Common.EditorApi.get(); @@ -142,7 +142,7 @@ class ContextMenu extends ContextMenuController { const { isEdit } = this.props; - if (isEdit) { + if (isEdit && EditorUIController.ContextMenu) { return EditorUIController.ContextMenu.mapMenuItems(this); } else { const { t } = this.props; diff --git a/apps/presentationeditor/mobile/src/controller/Main.jsx b/apps/presentationeditor/mobile/src/controller/Main.jsx index 60e7b6eda..8c5e89e0b 100644 --- a/apps/presentationeditor/mobile/src/controller/Main.jsx +++ b/apps/presentationeditor/mobile/src/controller/Main.jsx @@ -180,6 +180,8 @@ class MainController extends Component { this.api.asc_registerCallback('asc_onDocumentContentReady', this._onDocumentContentReady.bind(this)); this.api.asc_registerCallback('asc_onOpenDocumentProgress', this._onOpenDocumentProgress.bind(this)); + EditorUIController.initThemeColors && EditorUIController.initThemeColors(); + const storePresentationSettings = this.props.storePresentationSettings; this.api.asc_registerCallback('asc_onPresentationSize', (width, height) => { @@ -190,15 +192,15 @@ class MainController extends Component { storePresentationSettings.addSchemes(arr); }); - EditorUIController.initFocusObjects(this.props.storeFocusObjects); + EditorUIController.initFocusObjects && EditorUIController.initFocusObjects(this.props.storeFocusObjects); - EditorUIController.initEditorStyles(this.props.storeSlideSettings); + EditorUIController.initEditorStyles && EditorUIController.initEditorStyles(this.props.storeSlideSettings); // Text settings const storeTextSettings = this.props.storeTextSettings; - EditorUIController.initFonts(storeTextSettings); + EditorUIController.initFonts && EditorUIController.initFonts(storeTextSettings); this.api.asc_registerCallback('asc_onVerticalAlign', (typeBaseline) => { storeTextSettings.resetTypeBaseline(typeBaseline); @@ -257,17 +259,11 @@ class MainController extends Component { // Table settings - EditorUIController.initTableTemplates(this.props.storeTableSettings); + EditorUIController.initTableTemplates && EditorUIController.initTableTemplates(this.props.storeTableSettings); // Chart settings - const storeChartSettings = this.props.storeChartSettings; - - this.api.asc_registerCallback('asc_onUpdateChartStyles', () => { - if (storeFocusObjects.chartObject) { - storeChartSettings.updateChartStyles(this.api.asc_getChartPreviews(storeFocusObjects.chartObject.getType())); - } - }); + EditorUIController.updateChartStyles && EditorUIController.updateChartStyles(this.props.storeChartSettings, this.props.storeFocusObjects); } _onDocumentContentReady() { @@ -304,8 +300,7 @@ class MainController extends Component { - - + {EditorUIController.getEditCommentControllers && EditorUIController.getEditCommentControllers()} ) diff --git a/apps/presentationeditor/mobile/src/view/Toolbar.jsx b/apps/presentationeditor/mobile/src/view/Toolbar.jsx index 8251fd2b0..a97919f9e 100644 --- a/apps/presentationeditor/mobile/src/view/Toolbar.jsx +++ b/apps/presentationeditor/mobile/src/view/Toolbar.jsx @@ -8,7 +8,7 @@ const ToolbarView = props => { {props.isShowBack && } - {props.isEdit && EditorUIController.getUndoRedo({ + {props.isEdit && EditorUIController.getUndoRedo && EditorUIController.getUndoRedo({ disabledUndo: !props.isCanUndo, disabledRedo: !props.isCanRedo, onUndoClick: props.onUndo, @@ -18,7 +18,7 @@ const ToolbarView = props => { {!Device.phone && {props.docTitle}} {props.openOptions('preview')}}> - {props.isEdit && EditorUIController.getToolbarOptions({ + {props.isEdit && EditorUIController.getToolbarOptions && EditorUIController.getToolbarOptions({ disabledAdd: props.disabledAdd || props.disabledControls, disabledEdit: props.disabledEdit || props.disabledControls, onEditClick: () => props.openOptions('edit'),