Merge pull request #2766 from ONLYOFFICE/fix/bugfix

Fix/bugfix
This commit is contained in:
Julia Radzhabova
2023-12-26 18:28:40 +03:00
committed by GitHub
6 changed files with 60 additions and 7 deletions

View File

@ -1392,6 +1392,7 @@ define([
}, 50);
} else {
documentHolderController.getView().createDelayedElementsViewer();
Common.Utils.injectSvgIcons();
Common.NotificationCenter.trigger('document:ready', 'main');
me.applyLicense();
}

View File

@ -459,6 +459,7 @@ define([
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
}
this.api.asc_registerCallback('asc_onDownloadUrl', _.bind(this.onDownloadUrl, this));
Common.NotificationCenter.on('protect:doclock', _.bind(this.onChangeProtectDocument, this));
},
@ -3539,17 +3540,56 @@ define([
.setApi(me.api)
.onAppReady(config);
}
config.isOForm && config.canDownloadForms && !Common.localStorage.getBool("de-convert-oform") && Common.UI.warning({
msg : me.textConvertForm,
dontshow: true,
callback: function(btn, dontshow){
dontshow && Common.localStorage.setItem("de-convert-oform", 1);
config.isOForm && config.canDownloadForms && Common.UI.warning({
msg : config.canRequestSaveAs || !!config.saveAsUrl || config.isOffline ? me.textConvertFormSave : me.textConvertFormDownload,
buttons: [{value: 'ok', caption: config.canRequestSaveAs || !!config.saveAsUrl || config.isOffline ? me.textSavePdf : me.textDownloadPdf}, 'cancel'],
callback: function(btn){
if (btn==='ok') {
me.isFromFormSaveAs = config.canRequestSaveAs || !!config.saveAsUrl;
me.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF, me.isFromFormSaveAs));
}
Common.NotificationCenter.trigger('edit:complete');
}
});
});
},
onDownloadUrl: function(url, fileType) {
if (this.isFromFormSaveAs) {
var me = this,
defFileName = this.getApplication().getController('Viewport').getView('Common.Views.Header').getDocumentCaption();
!defFileName && (defFileName = me.txtUntitled);
var idx = defFileName.lastIndexOf('.');
if (idx>0)
defFileName = defFileName.substring(0, idx) + '.pdf';
if (me.mode.canRequestSaveAs) {
Common.Gateway.requestSaveAs(url, defFileName, fileType);
} else {
me._saveCopyDlg = new Common.Views.SaveAsDlg({
saveFolderUrl: me.mode.saveAsUrl,
saveFileUrl: url,
defFileName: defFileName
});
me._saveCopyDlg.on('saveaserror', function(obj, err){
Common.UI.warning({
closable: false,
msg: err,
callback: function(btn){
Common.NotificationCenter.trigger('edit:complete', me);
}
});
}).on('close', function(obj){
me._saveCopyDlg = undefined;
});
me._saveCopyDlg.show();
}
}
this.isFromFormSaveAs = false;
},
getView: function (name) {
return !name ? this.toolbar : Backbone.Controller.prototype.getView.apply(this, arguments);
},
@ -4016,7 +4056,11 @@ define([
textEmptyMMergeUrl: 'You need to specify URL.',
textRecentlyUsed: 'Recently Used',
dataUrl: 'Paste a data URL',
textConvertForm: 'Download file as pdf to save the form in the format ready for filling.'
textConvertFormSave: 'Save file as a fillable PDF form to be able to fill it out.',
textConvertFormDownload: 'Download file as a fillable PDF form to be able to fill it out.',
txtUntitled: 'Untitled',
textSavePdf: 'Save as pdf',
textDownloadPdf: 'Download pdf'
}, DE.Controllers.Toolbar || {}));
});

View File

@ -1214,7 +1214,12 @@
"DE.Controllers.Toolbar.notcriticalErrorTitle": "Warning",
"DE.Controllers.Toolbar.textAccent": "Accents",
"DE.Controllers.Toolbar.textBracket": "Brackets",
"DE.Controllers.Toolbar.textConvertForm": "Download file as pdf to save the form in the format ready for filling.",
"del_DE.Controllers.Toolbar.textConvertForm": "Download file as pdf to save the form in the format ready for filling.",
"DE.Controllers.Toolbar.textConvertFormDownload": "Download file as a fillable PDF form to be able to fill it out.",
"DE.Controllers.Toolbar.textConvertFormSave": "Save file as a fillable PDF form to be able to fill it out.",
"DE.Controllers.Toolbar.txtUntitled": "Untitled",
"DE.Controllers.Toolbar.textSavePdf": "Save as pdf",
"DE.Controllers.Toolbar.textDownloadPdf": "Download pdf",
"DE.Controllers.Toolbar.textEmptyImgUrl": "You need to specify image URL.",
"DE.Controllers.Toolbar.textEmptyMMergeUrl": "You need to specify URL.",
"DE.Controllers.Toolbar.textFontSizeErr": "The entered value is incorrect.<br>Please enter a numeric value between 1 and 300",

View File

@ -1031,6 +1031,7 @@ define([
}, 500);
} else {
Common.NotificationCenter.trigger('document:ready', 'main');
Common.Utils.injectSvgIcons();
me.applyLicense();
}

View File

@ -1002,6 +1002,7 @@ define([
}, 50);
} else {
documentHolderController.getView().createDelayedElementsViewer();
Common.Utils.injectSvgIcons();
Common.NotificationCenter.trigger('document:ready', 'main');
me.applyLicense();
}

View File

@ -1087,6 +1087,7 @@ define([
var formulasDlgController = application.getController('FormulaDialog');
formulasDlgController && formulasDlgController.setMode(me.appOptions).setApi(me.api);
documentHolderView.createDelayedElementsViewer();
Common.Utils.injectSvgIcons();
Common.NotificationCenter.trigger('document:ready', 'main');
me.applyLicense();
}