diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx index 6e4a3c53d..d2e87f6a8 100644 --- a/apps/documenteditor/mobile/src/controller/Main.jsx +++ b/apps/documenteditor/mobile/src/controller/Main.jsx @@ -223,6 +223,9 @@ class MainController extends Component { 'translate': t('Main.SDK', {returnObjects:true}) }); + Common.Notifications.trigger('engineCreated', this.api); + Common.EditorApi = {get: () => this.api}; + this.appOptions = {}; this.bindEvents(); @@ -230,9 +233,6 @@ class MainController extends Component { // Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me)); Common.Gateway.on('opendocument', loadDocument); Common.Gateway.appReady(); - - Common.Notifications.trigger('engineCreated', this.api); - Common.EditorApi = {get: () => this.api}; }, error => { console.log('promise failed ' + error); }); @@ -423,34 +423,12 @@ class MainController extends Component { this.api.asc_registerCallback('asc_onDocSize', (w, h) => { storeDocumentSettings.changeDocSize(w, h); }); - const storeFocusObjects = this.props.storeFocusObjects; - this.api.asc_registerCallback('asc_onFocusObject', objects => { - storeFocusObjects.resetFocusObjects(objects); - }); //text settings const storeTextSettings = this.props.storeTextSettings; - this.api.asc_registerCallback('asc_onInitEditorFonts', (fonts, select) => { - storeTextSettings.initEditorFonts(fonts, select); - }); - this.api.asc_registerCallback('asc_onFontFamily', (font) => { - storeTextSettings.resetFontName(font); - }); - this.api.asc_registerCallback('asc_onFontSize', (size) => { - storeTextSettings.resetFontSize(size); - }); - this.api.asc_registerCallback('asc_onBold', (isBold) => { - storeTextSettings.resetIsBold(isBold); - }); - this.api.asc_registerCallback('asc_onItalic', (isItalic) => { - storeTextSettings.resetIsItalic(isItalic); - }); - this.api.asc_registerCallback('asc_onUnderline', (isUnderline) => { - storeTextSettings.resetIsUnderline(isUnderline); - }); - this.api.asc_registerCallback('asc_onStrikeout', (isStrikeout) => { - storeTextSettings.resetIsStrikeout(isStrikeout); - }); + EditorUIController.initFonts(storeTextSettings); + EditorUIController.initFocusObjects(this.props.storeFocusObjects); + this.api.asc_registerCallback('asc_onVerticalAlign', (typeBaseline) => { storeTextSettings.resetTypeBaseline(typeBaseline); }); @@ -482,23 +460,14 @@ class MainController extends Component { }); //paragraph settings - this.api.asc_setParagraphStylesSizes(330, 38); - const storeParagraphSettings = this.props.storeParagraphSettings; - this.api.asc_registerCallback('asc_onInitEditorStyles', (styles) => { - storeParagraphSettings.initEditorStyles(styles); - }); - this.api.asc_registerCallback('asc_onParaStyleName', (name) => { - storeParagraphSettings.changeParaStyleName(name); - }); + EditorUIController.initEditorStyles(this.props.storeParagraphSettings); //table settings - const storeTableSettings = this.props.storeTableSettings; - this.api.asc_registerCallback('asc_onInitTableTemplates', (templates) => { - storeTableSettings.initTableTemplates(templates); - }); + 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())); diff --git a/apps/documenteditor/mobile/src/lib/patch.jsx b/apps/documenteditor/mobile/src/lib/patch.jsx index c6788a651..d3d114743 100644 --- a/apps/documenteditor/mobile/src/lib/patch.jsx +++ b/apps/documenteditor/mobile/src/lib/patch.jsx @@ -11,4 +11,10 @@ EditorUIController.getToolbarOptions = () => { return null }; +EditorUIController.initFonts = () => null; +EditorUIController.initEditorStyles = () => null; +EditorUIController.initFocusObjects = () => null; +EditorUIController.filterFocusObjects = () => []; +EditorUIController.initTableTemplates = () => null; + export default EditorUIController; diff --git a/apps/documenteditor/mobile/src/store/focusObjects.js b/apps/documenteditor/mobile/src/store/focusObjects.js index b9a9f4e16..7b75f2cec 100644 --- a/apps/documenteditor/mobile/src/store/focusObjects.js +++ b/apps/documenteditor/mobile/src/store/focusObjects.js @@ -1,4 +1,5 @@ import {action, observable, computed, makeObservable} from 'mobx'; +import EditorUIController from '../lib/patch' export class storeFocusObjects { constructor() { @@ -27,30 +28,7 @@ export class storeFocusObjects { } get settings() { - const _settings = []; - for (let object of this._focusObjects) { - let type = object.get_ObjectType(); - if (Asc.c_oAscTypeSelectElement.Paragraph === type) { - _settings.push('text', 'paragraph'); - } else if (Asc.c_oAscTypeSelectElement.Table === type) { - _settings.push('table'); - } else if (Asc.c_oAscTypeSelectElement.Image === type) { - if (object.get_ObjectValue().get_ChartProperties()) { - // Exclude shapes if chart exist - let si = _settings.indexOf('shape'); - si < 0 ? _settings.push('chart') : _settings.splice(si,1,'chart'); - } else if (object.get_ObjectValue().get_ShapeProperties() && !_settings.includes('chart')) { - _settings.push('shape'); - } else { - _settings.push('image'); - } - } else if (Asc.c_oAscTypeSelectElement.Hyperlink === type) { - _settings.push('hyperlink'); - } else if (Asc.c_oAscTypeSelectElement.Header === type) { - _settings.push('header'); - } - } - return _settings.filter((value, index, self) => self.indexOf(value) === index); + return EditorUIController.filterFocusObjects(this._focusObjects); } get headerType() { diff --git a/vendor/framework7-react/build/webpack.config.js b/vendor/framework7-react/build/webpack.config.js index 66d070865..96c99cba7 100644 --- a/vendor/framework7-react/build/webpack.config.js +++ b/vendor/framework7-react/build/webpack.config.js @@ -168,9 +168,11 @@ module.exports = { ...(env === 'production' ? [ new CssMinimizerPlugin({ - processorOptions: { - safe: true, - map: { inline: false }, + minimizerOptions: { + processorOptions: { + safe: true, + map: { inline: false }, + }, }, }), new webpack.optimize.ModuleConcatenationPlugin(),