From 1e16c5c9c595d390181613d867ea58f4f920f62a Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 22 Apr 2024 19:42:33 +0300 Subject: [PATCH] [DE][DE embed] Fix Bug 67561: open docxf/oform as pdf-form --- apps/api/documents/api.js | 11 +++++--- apps/documenteditor/embed/index.html | 3 +++ apps/documenteditor/embed/index.html.deploy | 3 +++ apps/documenteditor/embed/index_loader.html | 3 +++ .../embed/index_loader.html.deploy | 3 +++ .../embed/js/ApplicationController.js | 27 +++++++++++++++++-- apps/documenteditor/embed/locale/en.json | 2 ++ .../main/app/controller/Main.js | 4 +-- .../main/app/controller/Toolbar.js | 2 +- 9 files changed, 48 insertions(+), 10 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index c84bf703a6..842ac755be 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -1076,15 +1076,18 @@ if (config.frameEditorId) params += "&frameEditorId=" + config.frameEditorId; - var type = config.document ? /^(?:(pdf))$/.exec(config.document.fileType) : null; - if (!(type && typeof type[1] === 'string') && (config.editorConfig && config.editorConfig.mode == 'view' || + var type = config.document ? /^(?:(pdf)|(oform|docxf))$/.exec(config.document.fileType) : null, + isPdf = type && typeof type[1] === 'string', + oldForm = type && typeof type[2] === 'string'; + + if (!(isPdf || oldForm) && (config.editorConfig && config.editorConfig.mode == 'view' || config.document && config.document.permissions && (config.document.permissions.edit === false && !config.document.permissions.review ))) params += "&mode=view"; - if (type && typeof type[1] === 'string' && (config.document && config.document.permissions && config.document.permissions.edit === false || config.editorConfig && config.editorConfig.mode == 'view')) + if ((isPdf || oldForm) && (config.document && config.document.permissions && config.document.permissions.edit === false || config.editorConfig && config.editorConfig.mode == 'view')) params += "&mode=fillforms"; if (config.document) { - config.document.isForm = (type && typeof type[1] === 'string') ? config.document.isForm : false; + config.document.isForm = isPdf ? config.document.isForm : oldForm; (config.document.isForm===true || config.document.isForm===false) && (params += "&isForm=" + config.document.isForm); } diff --git a/apps/documenteditor/embed/index.html b/apps/documenteditor/embed/index.html index 8325c4c732..edaeadc6cd 100644 --- a/apps/documenteditor/embed/index.html +++ b/apps/documenteditor/embed/index.html @@ -251,6 +251,9 @@