From 35714543af6eb5802ea5ca498d3e8e0970fbd4a5 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 1 Dec 2023 21:25:12 +0300 Subject: [PATCH] Fix opening pdf and pdf-form files --- apps/documenteditor/embed/js/ApplicationController.js | 7 +++++-- apps/documenteditor/mobile/src/controller/Main.jsx | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index a09f7b5f85..68680b98ff 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -951,8 +951,11 @@ DE.ApplicationController = new(function(){ }); window["flat_desine"] = true; - var result = /[\?\&]fileType=\b(pdf|djvu|xps|oxps)\b&?/i.exec(window.location.search), - isPDF = (!!result && result.length && typeof result[1] === 'string'); + var result = /[\?\&]fileType=\b(pdf)|(djvu|xps|oxps)\b&?/i.exec(window.location.search), + docType = /[\?\&]documentType=\b(word)\b&?/i.exec(window.location.search), + isPDF = (!!result && result.length && typeof result[2] === 'string') || (!!result && result.length && typeof result[1] === 'string') && + (!docType || !docType.length || typeof docType[1] !== 'string'); + api = isPDF ? new Asc.PDFEditorApi({ 'id-view' : 'editor_sdk', diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx index 37d224a94f..090be416e0 100644 --- a/apps/documenteditor/mobile/src/controller/Main.jsx +++ b/apps/documenteditor/mobile/src/controller/Main.jsx @@ -345,8 +345,8 @@ class MainController extends Component { var result = /[\?\&]fileType=\b(pdf)|(djvu|xps|oxps)\b&?/i.exec(window.location.search), docType = /[\?\&]documentType=\b(word)\b&?/i.exec(window.location.search), - isPDF = (!!result && result.length && typeof result[2] === 'string') || !!result && result.length && typeof result[1] === 'string' && - !!docType && docType.length && typeof docType[1] !== 'string'; + isPDF = (!!result && result.length && typeof result[2] === 'string') || (!!result && result.length && typeof result[1] === 'string') && + (!docType || !docType.length || typeof docType[1] !== 'string'); this.api = isPDF ? new Asc.PDFEditorApi({ 'id-view' : 'editor_sdk',