Skip to content

Commit

Permalink
Fix opening pdf/djvu/xps
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Jan 14, 2025
1 parent c24e971 commit 8354e4f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions apps/api/documents/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@
const f = localStorage.getItem('asc-force-editor-type');
if ( f === 'desktop' ) {
config.editorConfig.forceDesktop = true;
return 'main';
return 'desktop';
}
}
}
Expand Down Expand Up @@ -1078,13 +1078,14 @@
fillForms = (config.document.permissions.fillForms===undefined ? config.document.permissions.edit !== false : config.document.permissions.fillForms) &&
config.editorConfig && (config.editorConfig.mode !== 'view');
}
var corrected_type = correct_app_type(config.type);
if (type && typeof type[2] === 'string') { // djvu|xps|oxps
appType = config.type === 'mobile' || config.type === 'embedded' ? 'word' : 'pdf';
appType = corrected_type === 'mobile' || corrected_type === 'embedded' ? 'word' : 'pdf';
} else if (type && typeof type[1] === 'string') { // pdf - need check
isForm = config.document ? config.document.isForm : undefined;
if (config.type === 'embedded')
if (corrected_type === 'embedded')
appType = fillForms && isForm===undefined ? 'common' : 'word';
else if (config.type !== 'mobile')
else if (corrected_type !== 'mobile')
appType = isForm===undefined ? 'common' : isForm ? 'word' : 'pdf';
} else if (type && typeof type[5] === 'string') { // oform|docxf
appType = 'word';
Expand All @@ -1101,8 +1102,8 @@
path = extendAppPath(config, path);
path += appMap[appType];

const path_type = config.type === "mobile" ? correct_app_type(config.type) :
config.type === "embedded" ? (fillForms && isForm ? "forms" : "embed") : "main";
const path_type = corrected_type === "mobile" ? "mobile" :
corrected_type === "embedded" ? (fillForms && isForm ? "forms" : "embed") : "main";
if (appType !== 'common')
path += "/" + path_type;

Expand Down

0 comments on commit 8354e4f

Please sign in to comment.