diff --git a/apps/common/Analytics.js b/apps/common/Analytics.js index f2985be6c..8c7bc4cd8 100644 --- a/apps/common/Analytics.js +++ b/apps/common/Analytics.js @@ -30,8 +30,8 @@ * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ -if (Common === undefined) - var Common = {}; +if (window.Common === undefined) + window.Common = {}; Common.component = Common.component || {}; diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx index 391f6dbdb..1b92e6b97 100644 --- a/apps/documenteditor/mobile/src/controller/Main.jsx +++ b/apps/documenteditor/mobile/src/controller/Main.jsx @@ -191,26 +191,59 @@ class MainController extends Component { }; const onDocumentContentReady = () => { - if (this.props.storeAppOptions.isEdit && this.needToUpdateVersion) { - Common.Notifications.trigger('api:disconnect'); - } + const appOptions = this.props.storeAppOptions; + const appSettings = this.props.storeApplicationSettings; - this.applyLicense(); - - Common.Gateway.documentReady(); f7.emit('resize'); - Common.Notifications.trigger('document:ready'); - this._isDocReady = true; + this.api.SetDrawingFreeze(false); + Common.Notifications.trigger('preloader:close'); Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument); + let value = LocalStorage.getItem("de-settings-zoom"); + const zf = (value !== null) ? parseInt(value) : (appOptions.customization && appOptions.customization.zoom ? parseInt(appOptions.customization.zoom) : 100); + (zf === -1) ? this.api.zoomFitToPage() : ((zf === -2) ? this.api.zoomFitToWidth() : this.api.zoom(zf>0 ? zf : 100)); + + value = LocalStorage.getBool("de-mobile-spellcheck", !(appOptions.customization && appOptions.customization.spellcheck === false)); + appSettings.changeSpellCheck(value); + this.api.asc_setSpellCheck(value); + + this.updateWindowTitle(true); + + this.api.SetTextBoxInputMode(LocalStorage.getBool("de-settings-inputmode")); + + value = LocalStorage.getBool("de-mobile-no-characters"); + appSettings.changeNoCharacters(value); + this.api.put_ShowParaMarks(value); + + value = LocalStorage.getBool("de-mobile-hidden-borders"); + appSettings.changeShowTableEmptyLine(value); + this.api.put_ShowTableEmptyLine(value); + + if (appOptions.isEdit && this.needToUpdateVersion) { + Common.Notifications.trigger('api:disconnect'); + } + Common.Gateway.on('processsaveresult', this.onProcessSaveResult.bind(this)); Common.Gateway.on('processrightschange', this.onProcessRightsChange.bind(this)); Common.Gateway.on('downloadas', this.onDownloadAs.bind(this)); Common.Gateway.on('requestclose', this.onRequestClose.bind(this)); + + Common.Gateway.sendInfo({ + mode: appOptions.isEdit ? 'edit' : 'view' + }); + + this.api.Resize(); + this.api.zoomFitToWidth(); + this.api.asc_GetDefaultTableStyles && setTimeout(() => {this.api.asc_GetDefaultTableStyles()}, 1); + + this.applyLicense(); + + Common.Notifications.trigger('document:ready'); + Common.Gateway.documentReady(); }; const _process_array = (array, fn) => { diff --git a/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx b/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx index c1239d2ab..388ea1ab7 100644 --- a/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx +++ b/apps/documenteditor/mobile/src/controller/settings/ApplicationSettings.jsx @@ -18,20 +18,17 @@ class ApplicationSettingsController extends Component { } switchSpellCheck(value) { - const api = Common.EditorApi.get(); - // let state = value === '1' ? true : false; - // Common.localStorage.setItem("de-mobile-spellcheck", value ? 1 : 0); - api.asc_setSpellCheck(value); + LocalStorage.setBool("de-mobile-spellcheck", value); + Common.EditorApi.get().asc_setSpellCheck(value); } switchNoCharacters(value) { - LocalStorage.setItem("de-mobile-no-characters", value); - + LocalStorage.setBool("de-mobile-no-characters", value); Common.EditorApi.get().put_ShowParaMarks(value); } switchShowTableEmptyLine(value) { - LocalStorage.setItem("de-mobile-hidden-borders", value); + LocalStorage.setBool("de-mobile-hidden-borders", value); Common.EditorApi.get().put_ShowTableEmptyLine(value); }