Merge pull request #1572 from ONLYOFFICE/fix/pdf-download

Fix/pdf download
This commit is contained in:
Julia Radzhabova 2022-02-16 13:02:13 +03:00 committed by GitHub
commit 47c582de47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 25 deletions

View file

@ -314,7 +314,6 @@ define([
options.asc_setTextParams(textParams);
if (format == Asc.c_oAscFileType.TXT || format == Asc.c_oAscFileType.RTF) {
Common.UI.warning({
closable: false,
title: this.notcriticalErrorTitle,
msg: (format == Asc.c_oAscFileType.TXT) ? this.warnDownloadAs : this.warnDownloadAsRTF,
buttons: ['ok', 'cancel'],
@ -374,22 +373,17 @@ define([
} else if (format == Asc.c_oAscFileType.PDF || format == Asc.c_oAscFileType.PDFA)
this._saveAsFormat(menu, format, ext);
else {
(new Common.Views.OptionsDialog({
width: 300,
title: this.titleConvertOptions,
label: this.textGroup,
items: [
{caption: this.textChar, value: Asc.c_oAscTextAssociation.BlockChar, checked: true},
{caption: this.textLine, value: Asc.c_oAscTextAssociation.BlockLine, checked: false},
{caption: this.textParagraph, value: Asc.c_oAscTextAssociation.PlainLine, checked: false}
],
handler: function (dlg, result) {
if (result=='ok') {
me._saveAsFormat(menu, format, ext, new AscCommon.asc_CTextParams(dlg.getSettings()));
Common.UI.warning({
width: 600,
title: this.notcriticalErrorTitle,
msg: Common.Utils.String.format(this.warnDownloadAsPdf, fileType.toUpperCase()),
buttons: ['ok', 'cancel'],
callback: _.bind(function(btn){
if (btn == 'ok') {
me._saveAsFormat(menu, format, ext, new AscCommon.asc_CTextParams(Asc.c_oAscTextAssociation.PlainLine));
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
}, this)
});
}
} else
this._saveAsFormat(menu, format, ext);
@ -930,11 +924,7 @@ define([
warnDownloadAsRTF : 'If you continue saving in this format some of the formatting might be lost.<br>Are you sure you want to continue?',
txtUntitled: 'Untitled',
txtCompatible: 'The document will be saved to the new format. It will allow to use all the editor features, but might affect the document layout.<br>Use the \'Compatibility\' option of the advanced settings if you want to make the files compatible with older MS Word versions.',
titleConvertOptions: 'Grouping options',
textGroup: 'Group by',
textChar: 'Char',
textLine: 'Line',
textParagraph: 'Paragraph'
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.'
}, DE.Controllers.LeftMenu || {}));
});

View file

@ -552,6 +552,7 @@ define([
this._state.isFromGatewayDownloadAs = true;
var _format = (format && (typeof format == 'string')) ? Asc.c_oAscFileType[ format.toUpperCase() ] : null,
_defaultFormat = null,
textParams,
_supported = [
Asc.c_oAscFileType.TXT,
Asc.c_oAscFileType.RTF,
@ -575,6 +576,7 @@ define([
else if (/^djvu$/.test(this.document.fileType)) {
_supported = [Asc.c_oAscFileType.PDF];
}
textParams = new AscCommon.asc_CTextParams(Asc.c_oAscTextAssociation.PlainLine);
} else {
_supported = _supported.concat([Asc.c_oAscFileType.PDF, Asc.c_oAscFileType.PDFA]);
_defaultFormat = Asc.c_oAscFileType.DOCX;
@ -584,7 +586,13 @@ define([
}
if ( !_format || _supported.indexOf(_format) < 0 )
_format = _defaultFormat;
_format ? this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format, true)) : this.api.asc_DownloadOrigin(true);
if (_format) {
var options = new Asc.asc_CDownloadOptions(_format, true);
textParams && options.asc_setTextParams(textParams);
this.api.asc_DownloadAs(options);
} else {
this.api.asc_DownloadOrigin(true);
}
},
onProcessMouse: function(data) {

View file

@ -1289,7 +1289,6 @@ define([
!Common.Utils.ModalWindow.isVisible() &&
Common.UI.warning({
width: 500,
closable: false,
msg: this.confirmAddFontName,
buttons: ['yes', 'no'],
primary: 'yes',

View file

@ -513,6 +513,7 @@
"DE.Controllers.LeftMenu.txtUntitled": "Untitled",
"DE.Controllers.LeftMenu.warnDownloadAs": "If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?",
"DE.Controllers.LeftMenu.warnDownloadAsRTF": "If you continue saving in this format some of the formatting might be lost.<br>Are you sure you want to continue?",
"DE.Controllers.LeftMenu.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.",
"DE.Controllers.Main.applyChangesTextText": "Loading the changes...",
"DE.Controllers.Main.applyChangesTitleText": "Loading the Changes",
"DE.Controllers.Main.convertationTimeoutText": "Conversion timeout exceeded.",

View file

@ -1272,7 +1272,6 @@ define([
!Common.Utils.ModalWindow.isVisible() &&
Common.UI.warning({
width: 500,
closable: false,
msg: this.confirmAddFontName,
buttons: ['yes', 'no'],
primary: 'yes',

View file

@ -1573,7 +1573,6 @@ define([
!Common.Utils.ModalWindow.isVisible() &&
Common.UI.warning({
width: 500,
closable: false,
msg: this.confirmAddFontName,
buttons: ['yes', 'no'],
primary: 'yes',