mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-04-07 14:06:16 +08:00
Merge pull request 'add docx to the formats not correctly converted to txt' (#909) from feature/turn-off-downloading-txt into develop
This commit is contained in:
@ -30,58 +30,59 @@ class DownloadController extends Component {
|
|||||||
const isNeedDownload = !!format;
|
const isNeedDownload = !!format;
|
||||||
const options = new Asc.asc_CDownloadOptions(format);
|
const options = new Asc.asc_CDownloadOptions(format);
|
||||||
options.asc_setIsSaveAs(isNeedDownload);
|
options.asc_setIsSaveAs(isNeedDownload);
|
||||||
|
const isPdfLike = /^pdf|xps|oxps|djvu$/.test(fileType);
|
||||||
if(/^pdf|xps|oxps|djvu$/.test(fileType)) {
|
|
||||||
|
if(isPdfLike)
|
||||||
this.closeModal();
|
this.closeModal();
|
||||||
|
|
||||||
if (format === Asc.c_oAscFileType.DJVU) {
|
if (format === Asc.c_oAscFileType.DJVU && isPdfLike) {
|
||||||
api.asc_DownloadOrigin(options);
|
api.asc_DownloadOrigin(options);
|
||||||
} else if(format === Asc.c_oAscFileType.PDF || format === Asc.c_oAscFileType.PDFA || format === Asc.c_oAscFileType.JPG || format === Asc.c_oAscFileType.PNG) {
|
} else if(format === Asc.c_oAscFileType.PDF || format === Asc.c_oAscFileType.PDFA || format === Asc.c_oAscFileType.JPG || format === Asc.c_oAscFileType.PNG) {
|
||||||
api.asc_DownloadAs(options);
|
api.asc_DownloadAs(options);
|
||||||
} else if (format === Asc.c_oAscFileType.TXT || format === Asc.c_oAscFileType.RTF) {
|
} else if (format === Asc.c_oAscFileType.TXT || format === Asc.c_oAscFileType.RTF) {
|
||||||
|
if(isPdfLike)
|
||||||
options.asc_setTextParams(new AscCommon.asc_CTextParams(Asc.c_oAscTextAssociation.PlainLine));
|
options.asc_setTextParams(new AscCommon.asc_CTextParams(Asc.c_oAscTextAssociation.PlainLine));
|
||||||
|
|
||||||
f7.dialog.create({
|
f7.dialog.create({
|
||||||
title: _t.notcriticalErrorTitle,
|
title: _t.notcriticalErrorTitle,
|
||||||
text: (format === Asc.c_oAscFileType.TXT) ? _t.textDownloadTxt : _t.textDownloadRtf,
|
text: (format === Asc.c_oAscFileType.TXT) ? _t.textDownloadTxt : _t.textDownloadRtf,
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
text: _t.textCancel
|
text: _t.textCancel
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: _t.textOk,
|
text: _t.textOk,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
if (format === Asc.c_oAscFileType.TXT) {
|
if (format === Asc.c_oAscFileType.TXT) {
|
||||||
const advOptions = api.asc_getAdvancedOptions();
|
const advOptions = api.asc_getAdvancedOptions();
|
||||||
Common.Notifications.trigger('openEncoding', Asc.c_oAscAdvancedOptionsID.TXT, advOptions, 2, options);
|
Common.Notifications.trigger('openEncoding', Asc.c_oAscAdvancedOptionsID.TXT, advOptions, 2, options);
|
||||||
} else {
|
} else {
|
||||||
api.asc_DownloadAs(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
}).open();
|
|
||||||
} else {
|
|
||||||
f7.dialog.create({
|
|
||||||
title: _t.notcriticalErrorTitle,
|
|
||||||
text: t('Main.warnDownloadAsPdf').replaceAll('{0}', fileType.toUpperCase()),
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
text: _t.textCancel
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: _t.textOk,
|
|
||||||
onClick: () => {
|
|
||||||
options.asc_setTextParams(new AscCommon.asc_CTextParams(Asc.c_oAscTextAssociation.PlainLine));
|
|
||||||
api.asc_DownloadAs(options);
|
api.asc_DownloadAs(options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
}
|
||||||
}).open();
|
],
|
||||||
}
|
}).open();
|
||||||
} else {
|
} else if(isPdfLike) {
|
||||||
|
f7.dialog.create({
|
||||||
|
title: _t.notcriticalErrorTitle,
|
||||||
|
text: t('Main.warnDownloadAsPdf').replaceAll('{0}', fileType.toUpperCase()),
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: _t.textCancel
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: _t.textOk,
|
||||||
|
onClick: () => {
|
||||||
|
options.asc_setTextParams(new AscCommon.asc_CTextParams(Asc.c_oAscTextAssociation.PlainLine));
|
||||||
|
api.asc_DownloadAs(options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}).open();
|
||||||
|
} else
|
||||||
api.asc_DownloadAs(options);
|
api.asc_DownloadAs(options);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
Reference in New Issue
Block a user