[DE mobile] Make document content ready in main controller, fix analytics error

This commit is contained in:
JuliaSvinareva 2021-04-13 13:51:21 +03:00
parent 813efeb874
commit 30b08d1dbb
3 changed files with 47 additions and 17 deletions

View file

@ -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 || {};

View file

@ -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) => {

View file

@ -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);
}