[DE mobile] Fix Bug 61340

This commit is contained in:
SergeyEzhin
2023-02-22 21:57:17 +04:00
parent d2e2f96f85
commit 479387d205
2 changed files with 54 additions and 31 deletions

View File

@ -566,7 +566,8 @@
"warnLicenseUsersExceeded": "You've reached the user limit for %1 editors. Contact your administrator to learn more.",
"warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only. Contact %1 sales team for personal upgrade terms.",
"warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
"warnProcessRightsChange": "You don't have permission to edit this file."
"warnProcessRightsChange": "You don't have permission to edit this file.",
"warnDownloadAsPdf": "Your {0} will be converted to an editable format. This may take a while. The resulting document will be optimized to allow you to edit the text, so it might not look exactly like the original {0}, especially if the original file contained lots of graphics."
},
"Settings": {
"advDRMOptions": "Protected File",

View File

@ -21,41 +21,63 @@ class DownloadController extends Component {
onSaveFormat(format) {
const api = Common.EditorApi.get();
const storeDocumentInfo = this.props.storeDocumentInfo;
const dataDoc = storeDocumentInfo.dataDoc;
const fileType = dataDoc.fileType;
const { t } = this.props;
const _t = t("Settings", { returnObjects: true });
if(format) {
this.closeModal();
if (format == Asc.c_oAscFileType.TXT || format == Asc.c_oAscFileType.RTF) {
f7.dialog.create({
title: _t.notcriticalErrorTitle,
text: (format === Asc.c_oAscFileType.TXT) ? _t.textDownloadTxt : _t.textDownloadRtf,
buttons: [
{
text: _t.textCancel
},
{
text: _t.textOk,
onClick: () => {
if (format == Asc.c_oAscFileType.TXT) {
const advOptions = api.asc_getAdvancedOptions();
Common.Notifications.trigger('openEncoding', Asc.c_oAscAdvancedOptionsID.TXT, advOptions, 2, new Asc.asc_CDownloadOptions(format));
}
else {
setTimeout(() => {
api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
}, 400);
if(/^pdf|xps|oxps|djvu$/.test(fileType)) {
if(format) {
this.closeModal();
if (format == Asc.c_oAscFileType.TXT || format == Asc.c_oAscFileType.RTF) {
f7.dialog.create({
title: _t.notcriticalErrorTitle,
text: (format === Asc.c_oAscFileType.TXT) ? _t.textDownloadTxt : _t.textDownloadRtf,
buttons: [
{
text: _t.textCancel
},
{
text: _t.textOk,
onClick: () => {
if (format == Asc.c_oAscFileType.TXT) {
const advOptions = api.asc_getAdvancedOptions();
Common.Notifications.trigger('openEncoding', Asc.c_oAscAdvancedOptionsID.TXT, advOptions, 2, new Asc.asc_CDownloadOptions(format));
} else {
setTimeout(() => {
api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
}, 400);
}
}
}
}
],
}).open();
}
else {
setTimeout(() => {
api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
}, 400);
],
}).open();
} else {
f7.dialog.create({
title: _t.notcriticalErrorTitle,
text: t('Main.warnDownloadAsPdf').replaceAll('{0}', fileType.toUpperCase()),
buttons: [
{
text: _t.textCancel
},
{
text: _t.textOk,
onClick: () => {
const options = new Asc.asc_CDownloadOptions(format);
options.asc_setTextParams(new AscCommon.asc_CTextParams(Asc.c_oAscTextAssociation.PlainLine));
api.asc_DownloadAs(options);
}
}
],
}).open();
}
}
} else {
setTimeout(() => {
api.asc_DownloadAs(new Asc.asc_CDownloadOptions(format));
}, 400);
}
}
@ -66,7 +88,7 @@ class DownloadController extends Component {
}
}
const DownloadWithTranslation = inject("storeAppOptions")(observer(withTranslation()(DownloadController)));
const DownloadWithTranslation = inject("storeAppOptions", "storeDocumentInfo")(observer(withTranslation()(DownloadController)));
const onAdvancedOptions = (type, _t, isDocReady, canRequestClose, isDRM) => {
if ($$('.dlg-adv-options.modal-in').length > 0) return;