Open pdf-form files via pdf editor

This commit is contained in:
Julia Radzhabova
2023-12-09 13:16:19 +03:00
parent 3690029985
commit f18d44056a
4 changed files with 20 additions and 15 deletions

View File

@ -960,16 +960,14 @@
if (typeof type[3] === 'string' && config.type !== 'mobile' && config.type !== 'embedded') appType = 'pdf';
}
}
if (appType === 'pdf' && (config.type === 'mobile' || config.type === 'embedded' || config.document && config.document.isForm)) {
if (appType === 'pdf' && (config.type === 'mobile' || config.type === 'embedded')) {
appType = 'word';
}
path += appMap[appType] + "/";
const path_type = config.type === "mobile"
? "mobile" : (config.type === "embedded")
? "embed" : (config.document && typeof config.document.fileType === 'string' && config.document.fileType.toLowerCase() === 'pdf' &&
appType==='word')
? "forms" : "main";
? "embed" : "main";
path += path_type;
var index = "/index.html";
@ -1038,7 +1036,7 @@
if (config.document && config.document.fileType)
params += "&fileType=" + config.document.fileType;
if (config.document && config.isForm)
if (config.document && config.document.isForm)
params += "&isForm=true";
return params;

View File

@ -448,14 +448,6 @@ define([
config.isEdit && config.canFeatureContentControl && config.isFormCreator && !config.isOForm && me.showHelpTip('create'); // show tip only when create form in docxf
me.onRefreshRolesList();
me.onChangeProtectDocument();
config.isOForm && config.canDownloadForms && !Common.localStorage.getBool("de-convert-oform") && Common.UI.warning({
msg : me.view.tipSaveFile,
dontshow: true,
callback: function(btn, dontshow){
dontshow && Common.localStorage.setItem("de-convert-oform", 1);
Common.NotificationCenter.trigger('edit:complete');
}
});
});
},

View File

@ -3539,6 +3539,14 @@ 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);
Common.NotificationCenter.trigger('edit:complete');
}
});
});
},
@ -4007,7 +4015,8 @@ define([
textGroup: 'Group',
textEmptyMMergeUrl: 'You need to specify URL.',
textRecentlyUsed: 'Recently Used',
dataUrl: 'Paste a data URL'
dataUrl: 'Paste a data URL',
textConvertForm: 'Download file as pdf to save the form in the format ready for filling.',
}, DE.Controllers.Toolbar || {}));
});

View File

@ -131,7 +131,13 @@ define([
// Create and render main view
this.viewport = this.createView('Viewport').render();
this.api = new Asc.PDFEditorApi({
this.isForm = /[\?\&]isForm=\btrue\b&?/i.exec(window.location.search);
this.isXpsViewer = /[\?\&]fileType=\b(djvu|xps|oxps)\b&?/i.exec(window.location.search);
this.api = (!!this.isXpsViewer || !this.isForm) ? new Asc.PDFEditorApi({
'id-view' : 'editor_sdk',
'translate': this.getApplication().getController('Main').translationTable
}) : new Asc.asc_docs_api({
'id-view' : 'editor_sdk',
'translate': this.getApplication().getController('Main').translationTable
});