diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json
index 9ca0208b9..7e4fee34d 100644
--- a/apps/documenteditor/mobile/locale/en.json
+++ b/apps/documenteditor/mobile/locale/en.json
@@ -94,7 +94,8 @@
"errorUpdateVersionOnDisconnect": "Internet connection has been restored, and the file version has been changed.
Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.",
"errorDefaultMessage": "Error code: %1",
"criticalErrorExtText": "Press 'OK' to back to document list.",
- "notcriticalErrorTitle": "Warning"
+ "notcriticalErrorTitle": "Warning",
+ "scriptLoadError": "The connection is too slow, some of the components could not be loaded. Please reload the page."
},
"LongActions": {
"openTitleText": "Opening Document",
diff --git a/apps/documenteditor/mobile/src/controller/Error.jsx b/apps/documenteditor/mobile/src/controller/Error.jsx
index 6ae81ef0d..ff499f251 100644
--- a/apps/documenteditor/mobile/src/controller/Error.jsx
+++ b/apps/documenteditor/mobile/src/controller/Error.jsx
@@ -1,8 +1,7 @@
-import React, { useEffect, useState } from 'react';
+import React, { useEffect } from 'react';
import { inject } from 'mobx-react';
import { f7 } from 'framework7-react';
import { useTranslation } from 'react-i18next';
-import LongActionsController from "./LongActions";
const ErrorController = inject('storeAppOptions')(({storeAppOptions, LoadingDocument}) => {
const {t} = useTranslation();
@@ -22,7 +21,7 @@ const ErrorController = inject('storeAppOptions')(({storeAppOptions, LoadingDocu
if (id === Asc.c_oAscError.ID.LoadingScriptError) {
f7.notification.create({
title: _t.criticalErrorTitle,
- text: _t.criticalErrorTitle,
+ text: _t.scriptLoadError,
closeButton: true
}).open();
return;
@@ -183,7 +182,7 @@ const ErrorController = inject('storeAppOptions')(({storeAppOptions, LoadingDocu
// report only critical errors
Common.Gateway.reportError(id, config.msg);
- config.title = this.criticalErrorTitle;
+ config.title = _t.criticalErrorTitle;
if (storeAppOptions.canBackToFolder && !storeAppOptions.isDesktopApp) {
config.msg += '' + _t.criticalErrorExtText;
diff --git a/apps/documenteditor/mobile/src/controller/LongActions.jsx b/apps/documenteditor/mobile/src/controller/LongActions.jsx
index 2c2e0f9fb..5365f7264 100644
--- a/apps/documenteditor/mobile/src/controller/LongActions.jsx
+++ b/apps/documenteditor/mobile/src/controller/LongActions.jsx
@@ -20,7 +20,7 @@ class LongActions extends Component {
}
closePreloader() {
- if (this.loadMask.el) {
+ if (this.loadMask && this.loadMask.el) {
f7.dialog.close(this.loadMask.el);
}
}
@@ -70,7 +70,7 @@ class LongActions extends Component {
if (action) {
this.setLongActionView(action)
} else {
- this.loadMask.el && this.loadMask.el.classList.contains('modal-in') && f7.dialog.close(this.loadMask.el);
+ this.loadMask && this.loadMask.el && this.loadMask.el.classList.contains('modal-in') && f7.dialog.close(this.loadMask.el);
}
}
diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx
index 061f1eae9..45e56bb10 100644
--- a/apps/documenteditor/mobile/src/controller/Main.jsx
+++ b/apps/documenteditor/mobile/src/controller/Main.jsx
@@ -189,6 +189,9 @@ class MainController extends Component {
};
const onDocumentContentReady = () => {
+ if (this._isDocReady)
+ return;
+
const appOptions = this.props.storeAppOptions;
const appSettings = this.props.storeApplicationSettings;
@@ -327,8 +330,8 @@ class MainController extends Component {
Common.Utils.Metric.setCurrentMetric(value);
this.api.asc_SetDocumentUnits((value === Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value===Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter));
- //me.api.asc_registerCallback('asc_onDocumentModifiedChanged', _.bind(me.onDocumentModifiedChanged, me));
- //me.api.asc_registerCallback('asc_onDocumentCanSaveChanged', _.bind(me.onDocumentCanSaveChanged, me));
+ this.api.asc_registerCallback('asc_onDocumentModifiedChanged', this.onDocumentModifiedChanged.bind(this));
+ this.api.asc_registerCallback('asc_onDocumentCanSaveChanged', this.onDocumentCanSaveChanged.bind(this));
//if (me.stackLongActions.exist({id: ApplyEditRights, type: Asc.c_oAscAsyncActionType['BlockInteraction']})) {
// me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], ApplyEditRights);
@@ -342,6 +345,19 @@ class MainController extends Component {
window.onunload = this.onUnload.bind(this);
}
+ onDocumentModifiedChanged () {
+ const isModified = this.api.asc_isDocumentCanSave();
+ if (this._state.isDocModified !== isModified) {
+ this._isDocReady && Common.Gateway.setDocumentModified(this.api.isDocumentModified());
+ }
+
+ this.updateWindowTitle();
+ }
+
+ onDocumentCanSaveChanged (isCanSave) {
+ //
+ }
+
onBeforeUnload () {
LocalStorage.save();
@@ -485,6 +501,7 @@ class MainController extends Component {
this.api.asc_registerCallback('asc_onServerVersion', this.onServerVersion.bind(this));
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_onPrint', this.onPrint.bind(this));
EditorUIController.initThemeColors && EditorUIController.initThemeColors();
@@ -677,6 +694,14 @@ class MainController extends Component {
}
}
+ onPrint () {
+ if (!this.props.storeAppOptions.canPrint) return;
+
+ if (this.api)
+ this.api.asc_Print();
+ Common.component.Analytics.trackEvent('Print');
+ }
+
onPrintUrl (url) {
if (this.iframePrint) {
this.iframePrint.parentNode.removeChild(this.iframePrint);
diff --git a/apps/documenteditor/mobile/src/controller/settings/Download.jsx b/apps/documenteditor/mobile/src/controller/settings/Download.jsx
index 5bf78d0ba..187b65c7b 100644
--- a/apps/documenteditor/mobile/src/controller/settings/Download.jsx
+++ b/apps/documenteditor/mobile/src/controller/settings/Download.jsx
@@ -55,6 +55,8 @@ class DownloadController extends Component {
const DownloadWithTranslation = withTranslation()(DownloadController);
const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, canRequestClose) => {
+ if ($$('.dlg-adv-options.modal-in').length > 0) return;
+
const api = Common.EditorApi.get();
if (type == Asc.c_oAscAdvancedOptionsID.TXT) {
let picker;
@@ -97,7 +99,8 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, canRequest
'' +
'