Merge pull request #922 from ONLYOFFICE/fix/fix-bugs-on-mobiles

Fix/fix bugs on mobiles
This commit is contained in:
maxkadushkin 2021-06-11 16:51:04 +03:00 committed by GitHub
commit badd41c924
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 64 additions and 83 deletions

View file

@ -39,11 +39,7 @@ const LongActionsController = () => {
api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd); api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd);
api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument); api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument);
Common.Notifications.off('preloader:endAction', (type, id) => { Common.Notifications.off('preloader:endAction', onLongActionEnd);
if (stackLongActions.exist({id: id, type: type})) {
onLongActionEnd(type, id);
}
});
Common.Notifications.off('preloader:beginAction', onLongActionBegin); Common.Notifications.off('preloader:beginAction', onLongActionBegin);
Common.Notifications.off('preloader:close', closePreloader); Common.Notifications.off('preloader:close', closePreloader);
}) })
@ -55,22 +51,18 @@ const LongActionsController = () => {
setLongActionView(action); setLongActionView(action);
}; };
const onLongActionEnd = (type, id) => { const onLongActionEnd = (type, id, forceClose) => {
if (!stackLongActions.exist({id: id, type: type})) return;
let action = {id: id, type: type}; let action = {id: id, type: type};
stackLongActions.pop(action); stackLongActions.pop(action);
//this.updateWindowTitle(true); //this.updateWindowTitle(true);
action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.Information}); action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.Information}) || stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction});
if (action) { if (action && !forceClose) {
setLongActionView(action) setLongActionView(action);
}
action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction});
if (action) {
setLongActionView(action)
} else { } else {
loadMask && loadMask.el && loadMask.el.classList.contains('modal-in') && f7.dialog.close(loadMask.el); loadMask && loadMask.el && loadMask.el.classList.contains('modal-in') && f7.dialog.close(loadMask.el);
} }

View file

@ -70,7 +70,7 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, isDocReady
pagesName.push(page.asc_getCodePageName()); pagesName.push(page.asc_getCodePageName());
} }
Common.Notifications.trigger('preloader:close'); Common.Notifications.trigger('preloader:close');
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256); Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256, true);
const buttons = []; const buttons = [];
if (mode === 2) { if (mode === 2) {
buttons.push({ buttons.push({
@ -122,16 +122,16 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, isDocReady
}); });
} else if (type == Asc.c_oAscAdvancedOptionsID.DRM) { } else if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
Common.Notifications.trigger('preloader:close'); Common.Notifications.trigger('preloader:close');
// Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256); Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256, true);
const buttons = [{ const buttons = [{
text: 'OK', text: 'OK',
bold: true, bold: true,
onClick: function () { onClick: function () {
const password = document.getElementById('modal-password').value; const password = document.getElementById('modal-password').value;
api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(password)); api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(password));
// if (!isDocReady) { if (!isDocReady) {
// Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256); Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256);
// } }
} }
}]; }];
if (canRequestClose) if (canRequestClose)

View file

@ -39,11 +39,7 @@ const LongActionsController = () => {
api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd); api.asc_unregisterCallback('asc_onEndAction', onLongActionEnd);
api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument); api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument);
Common.Notifications.off('preloader:endAction', (type, id) => { Common.Notifications.off('preloader:endAction', onLongActionEnd);
if (stackLongActions.exist({id: id, type: type})) {
onLongActionEnd(type, id);
}
});
Common.Notifications.off('preloader:beginAction', onLongActionBegin); Common.Notifications.off('preloader:beginAction', onLongActionBegin);
Common.Notifications.off('preloader:close', closePreloader); Common.Notifications.off('preloader:close', closePreloader);
}) })
@ -55,21 +51,17 @@ const LongActionsController = () => {
setLongActionView(action); setLongActionView(action);
}; };
const onLongActionEnd = (type, id) => { const onLongActionEnd = (type, id, forceClose) => {
if (!stackLongActions.exist({id: id, type: type})) return;
let action = {id: id, type: type}; let action = {id: id, type: type};
stackLongActions.pop(action); stackLongActions.pop(action);
//this.updateWindowTitle(true); //this.updateWindowTitle(true);
action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.Information}); action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.Information}) || stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction});
if (action) { if (action && !forceClose) {
setLongActionView(action)
}
action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction});
if (action) {
setLongActionView(action) setLongActionView(action)
} else { } else {
loadMask && loadMask.el && loadMask.el.classList.contains('modal-in') && f7.dialog.close(loadMask.el); loadMask && loadMask.el && loadMask.el.classList.contains('modal-in') && f7.dialog.close(loadMask.el);

View file

@ -590,7 +590,7 @@ class MainController extends Component {
if (type == Asc.c_oAscAdvancedOptionsID.DRM) { if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
Common.Notifications.trigger('preloader:close'); Common.Notifications.trigger('preloader:close');
// Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument); Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument, true);
const buttons = [{ const buttons = [{
text: 'OK', text: 'OK',
@ -599,9 +599,9 @@ class MainController extends Component {
const password = document.getElementById('modal-password').value; const password = document.getElementById('modal-password').value;
this.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(password)); this.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(password));
// if (!this._isDocReady) { if (!this._isDocReady) {
// Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument); Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
// } }
} }
}]; }];
if (this.props.storeAppOptions.canRequestClose) if (this.props.storeAppOptions.canRequestClose)

View file

@ -41,11 +41,7 @@ const LongActionsController = () => {
api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument); api.asc_unregisterCallback('asc_onOpenDocumentProgress', onOpenDocument);
api.asc_unregisterCallback('asc_onConfirmAction', onConfirmAction); api.asc_unregisterCallback('asc_onConfirmAction', onConfirmAction);
Common.Notifications.off('preloader:endAction', (type, id) => { Common.Notifications.off('preloader:endAction', onLongActionEnd);
if (stackLongActions.exist({id: id, type: type})) {
onLongActionEnd(type, id);
}
});
Common.Notifications.off('preloader:beginAction', onLongActionBegin); Common.Notifications.off('preloader:beginAction', onLongActionBegin);
Common.Notifications.off('preloader:close', closePreloader); Common.Notifications.off('preloader:close', closePreloader);
}) })
@ -57,21 +53,17 @@ const LongActionsController = () => {
setLongActionView(action); setLongActionView(action);
}; };
const onLongActionEnd = (type, id) => { const onLongActionEnd = (type, id, forceClose) => {
if (!stackLongActions.exist({id: id, type: type})) return;
let action = {id: id, type: type}; let action = {id: id, type: type};
stackLongActions.pop(action); stackLongActions.pop(action);
//this.updateWindowTitle(true); //this.updateWindowTitle(true);
action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.Information}); action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.Information}) || stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction});
if (action) { if (action && !forceClose) {
setLongActionView(action)
}
action = stackLongActions.get({type: Asc.c_oAscAsyncActionType.BlockInteraction});
if (action) {
setLongActionView(action) setLongActionView(action)
} else { } else {
loadMask && loadMask.el && loadMask.el.classList.contains('modal-in') && f7.dialog.close(loadMask.el); loadMask && loadMask.el && loadMask.el.classList.contains('modal-in') && f7.dialog.close(loadMask.el);

View file

@ -323,7 +323,7 @@ class MainController extends Component {
this.api.asc_registerCallback('asc_onAdvancedOptions', (type, advOptions, mode, formatOptions) => { this.api.asc_registerCallback('asc_onAdvancedOptions', (type, advOptions, mode, formatOptions) => {
const {t} = this.props; const {t} = this.props;
const _t = t("View.Settings", { returnObjects: true }); const _t = t("View.Settings", { returnObjects: true });
onAdvancedOptions(type, advOptions, mode, formatOptions, _t, this.props.storeAppOptions.canRequestClose); onAdvancedOptions(type, advOptions, mode, formatOptions, _t, this._isDocReady, this.props.storeAppOptions.canRequestClose);
}); });
} }

View file

@ -21,7 +21,7 @@ class DownloadController extends Component {
_t.warnDownloadAs, _t.warnDownloadAs,
_t.notcriticalErrorTitle, _t.notcriticalErrorTitle,
function () { function () {
onAdvancedOptions(Asc.c_oAscAdvancedOptionsID.CSV, api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format), _t) onAdvancedOptions(Asc.c_oAscAdvancedOptionsID.CSV, api.asc_getAdvancedOptions(), 2, new Asc.asc_CDownloadOptions(format), _t, true);
} }
) )
} else { } else {
@ -39,7 +39,7 @@ class DownloadController extends Component {
const DownloadWithTranslation = withTranslation()(DownloadController); const DownloadWithTranslation = withTranslation()(DownloadController);
const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, canRequestClose) => { const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, isDocReady, canRequestClose) => {
const api = Common.EditorApi.get(); const api = Common.EditorApi.get();
if (type == Asc.c_oAscAdvancedOptionsID.CSV) { if (type == Asc.c_oAscAdvancedOptionsID.CSV) {
@ -52,7 +52,8 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, canRequest
pagesName.push(page.asc_getCodePageName()); pagesName.push(page.asc_getCodePageName());
} }
// me.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument); Common.Notifications.trigger('preloader:close');
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256, true);
const buttons = []; const buttons = [];
@ -76,9 +77,9 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, canRequest
api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(encoding, delimiter)); api.asc_setAdvancedOptions(type, new Asc.asc_CTextOptions(encoding, delimiter));
} }
//if (!me._isDocReady) { if (!isDocReady) {
//me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256);
//} }
} }
}); });
@ -122,16 +123,16 @@ const onAdvancedOptions = (type, advOptions, mode, formatOptions, _t, canRequest
} else if (type == Asc.c_oAscAdvancedOptionsID.DRM) { } else if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
Common.Notifications.trigger('preloader:close'); Common.Notifications.trigger('preloader:close');
//me.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument); Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256, true);
const buttons = [{ const buttons = [{
text: 'OK', text: 'OK',
bold: true, bold: true,
onClick: function () { onClick: function () {
const password = document.getElementById('modal-password').value; const password = document.getElementById('modal-password').value;
api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(password)); api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(password));
//if (!me._isDocReady) { if (!isDocReady) {
//me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); Common.Notifications.trigger('preloader:beginAction', Asc.c_oAscAsyncActionType['BlockInteraction'], -256);
//} }
} }
}]; }];

View file

@ -6,13 +6,17 @@ class SpreadsheetInfoController extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.docProps = this.getDocProps(); this.docProps = this.getDocProps();
this.getModified = this.getModified(); if (this.docProps) {
this.getModifiedBy = this.getModifiedBy(); this.dataApp = this.getAppProps();
this.getCreators = this.getCreators(); this.modified = this.getModified();
this.title = this.getTitle(); this.modifiedBy = this.getModifiedBy();
this.subject = this.getSubject(); this.creators = this.getCreators();
this.description = this.getDescription(); this.title = this.getTitle();
this.getCreated = this.getCreated(); this.subject = this.getSubject();
this.description = this.getDescription();
this.created = this.getCreated();
}
} }
getDocProps() { getDocProps() {
@ -23,7 +27,6 @@ class SpreadsheetInfoController extends Component {
getAppProps() { getAppProps() {
const api = Common.EditorApi.get(); const api = Common.EditorApi.get();
const appProps = api.asc_getAppProps(); const appProps = api.asc_getAppProps();
if (appProps) { if (appProps) {
let appName = let appName =
(appProps.asc_getApplication() || "") + (appProps.asc_getApplication() || "") +
@ -31,12 +34,12 @@ class SpreadsheetInfoController extends Component {
(appProps.asc_getAppVersion() || ""); (appProps.asc_getAppVersion() || "");
return appName; return appName;
} }
return null;
} }
getModified() { getModified() {
let valueModified = this.docProps.asc_getModified(); let valueModified = this.docProps.asc_getModified();
const _lang = this.props.storeAppOptions.lang; const _lang = this.props.storeAppOptions.lang;
if (valueModified) { if (valueModified) {
return ( return (
valueModified.toLocaleString(_lang, { valueModified.toLocaleString(_lang, {
@ -48,14 +51,15 @@ class SpreadsheetInfoController extends Component {
valueModified.toLocaleTimeString(_lang, { timeStyle: "short" }) valueModified.toLocaleTimeString(_lang, { timeStyle: "short" })
); );
} }
return null;
} }
getModifiedBy() { getModifiedBy() {
let valueModifiedBy = this.docProps.asc_getLastModifiedBy(); let valueModifiedBy = this.docProps.asc_getLastModifiedBy();
if (valueModifiedBy) { if (valueModifiedBy) {
return Common.Utils.UserInfoParser.getParsedName(valueModifiedBy); return Common.Utils.UserInfoParser.getParsedName(valueModifiedBy);
} }
return null;
} }
getCreators() { getCreators() {
@ -77,20 +81,20 @@ class SpreadsheetInfoController extends Component {
getCreated() { getCreated() {
let value = this.docProps.asc_getCreated(); let value = this.docProps.asc_getCreated();
const _lang = this.props.storeAppOptions.lang; const _lang = this.props.storeAppOptions.lang;
if(value) { if(value) {
return value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleTimeString(_lang, {timeStyle: 'short'}); return value.toLocaleString(_lang, {year: 'numeric', month: '2-digit', day: '2-digit'}) + ' ' + value.toLocaleTimeString(_lang, {timeStyle: 'short'});
} }
return null;
} }
render() { render() {
return ( return (
<SpreadsheetInfo <SpreadsheetInfo
getAppProps={this.getAppProps} dataApp={this.dataApp}
getModified={this.getModified} modified={this.modified}
getModifiedBy={this.getModifiedBy} modifiedBy={this.modifiedBy}
getCreators={this.getCreators} creators={this.creators}
getCreated={this.getCreated} created={this.created}
title={this.title} title={this.title}
subject={this.subject} subject={this.subject}
description={this.description} description={this.description}

View file

@ -7,11 +7,11 @@ const PageSpreadsheetInfo = (props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const _t = t("View.Settings", { returnObjects: true }); const _t = t("View.Settings", { returnObjects: true });
const storeSpreadsheetInfo = props.storeSpreadsheetInfo; const storeSpreadsheetInfo = props.storeSpreadsheetInfo;
const dataApp = props.getAppProps();
const dataModified = props.getModified;
const dataModifiedBy = props.getModifiedBy;
const creators = props.getCreators;
const dataDoc = storeSpreadsheetInfo.dataDoc; const dataDoc = storeSpreadsheetInfo.dataDoc;
const dataApp = props.dataApp;
const dataModified = props.modified;
const dataModifiedBy = props.modifiedBy;
const creators = props.creators;
return ( return (
<Page> <Page>