From 751fedc66316658cc6bdf0eaffe20c4cca2c80e0 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Mon, 13 Sep 2021 00:51:01 +0300 Subject: [PATCH] [DE] skeleton refactoring --- apps/documenteditor/mobile/src/app.js | 4 +- .../mobile/src/controller/Error.jsx | 2 +- .../mobile/src/controller/LongActions.jsx | 8 +- .../mobile/src/controller/Main.jsx | 7 +- apps/documenteditor/mobile/src/index_dev.html | 117 +++++++++++++++++- apps/documenteditor/mobile/src/lib/i18n.js | 3 + apps/documenteditor/mobile/src/page/main.jsx | 4 + 7 files changed, 136 insertions(+), 9 deletions(-) diff --git a/apps/documenteditor/mobile/src/app.js b/apps/documenteditor/mobile/src/app.js index dc39d91b6..cc9445153 100644 --- a/apps/documenteditor/mobile/src/app.js +++ b/apps/documenteditor/mobile/src/app.js @@ -36,9 +36,9 @@ Framework7.use(Framework7React) ReactDOM.render( - + {/**/} - + {/**/} , document.getElementById('app'), diff --git a/apps/documenteditor/mobile/src/controller/Error.jsx b/apps/documenteditor/mobile/src/controller/Error.jsx index 6910f56b6..7a9f49a26 100644 --- a/apps/documenteditor/mobile/src/controller/Error.jsx +++ b/apps/documenteditor/mobile/src/controller/Error.jsx @@ -13,7 +13,7 @@ const ErrorController = inject('storeAppOptions')(({storeAppOptions, LoadingDocu }); return () => { const api = Common.EditorApi.get(); - api.asc_unregisterCallback('asc_onError', onError); + if ( api ) api.asc_unregisterCallback('asc_onError', onError); } }); diff --git a/apps/documenteditor/mobile/src/controller/LongActions.jsx b/apps/documenteditor/mobile/src/controller/LongActions.jsx index f6e31b73d..28343acc5 100644 --- a/apps/documenteditor/mobile/src/controller/LongActions.jsx +++ b/apps/documenteditor/mobile/src/controller/LongActions.jsx @@ -35,9 +35,11 @@ const LongActionsController = () => { return ( () => { const api = Common.EditorApi.get(); - api.asc_unregisterCallback('asc_onStartAction', onLongActionBegin); - api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd); - api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument); + if ( api ) { + api.asc_unregisterCallback('asc_onStartAction', onLongActionBegin); + api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd); + api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument); + } Common.Notifications.off('preloader:endAction', onLongActionEnd); Common.Notifications.off('preloader:beginAction', onLongActionBegin); diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx index b39ad5f69..e3cd774e1 100644 --- a/apps/documenteditor/mobile/src/controller/Main.jsx +++ b/apps/documenteditor/mobile/src/controller/Main.jsx @@ -279,7 +279,7 @@ class MainController extends Component { }); Common.Notifications.trigger('engineCreated', this.api); - Common.EditorApi = {get: () => this.api}; + // Common.EditorApi = {get: () => this.api}; // Set font rendering mode let value = LocalStorage.getItem("de-settings-fontrender"); @@ -405,7 +405,9 @@ class MainController extends Component { } applyLicense () { - const _t = this._t; + const { t } = this.props; + const _t = t('Main', {returnObjects:true}); + const warnNoLicense = _t.warnNoLicense.replace(/%1/g, __COMPANY_NAME__); const warnNoLicenseUsers = _t.warnNoLicenseUsers.replace(/%1/g, __COMPANY_NAME__); const textNoLicenseTitle = _t.textNoLicenseTitle.replace(/%1/g, __COMPANY_NAME__); @@ -851,6 +853,7 @@ class MainController extends Component { } componentDidMount() { + Common.EditorApi = {get: () => this.api}; this.initSdk(); } } diff --git a/apps/documenteditor/mobile/src/index_dev.html b/apps/documenteditor/mobile/src/index_dev.html index a0ead6c1a..9df63310f 100644 --- a/apps/documenteditor/mobile/src/index_dev.html +++ b/apps/documenteditor/mobile/src/index_dev.html @@ -22,17 +22,128 @@ - + + +
+
+
+
+
+
+
+