Fix Bug 69398 - Files.Editor. There is no transition from viewing mode to editing mode in the editor using the Edit current file button.

This commit is contained in:
Alexey Safronov 2024-07-25 16:44:40 +04:00
parent 2aad778872
commit a90aff601d

View File

@ -81,30 +81,31 @@ export const onSDKRequestEditRights = async (
const url = window.location.href; const url = window.location.href;
const isPDF = documentType === "pdf"; const isPDF = documentType === "pdf";
if (isPDF) { let newURL = new URL(url);
const newURL = new URL(url);
if (newURL.searchParams.has("action")) { if (
newURL.searchParams.delete("action"); !isPDF &&
fileInfo?.viewAccessibility?.MustConvert &&
fileInfo?.security?.Convert
) {
try {
const response = await convertDocumentUrl(fileInfo.id);
if (response && response.webUrl) {
newURL = new URL(response.webUrl);
} else {
throw new Error("Invalid response data");
}
} catch (error) {
console.error("Error converting document", { error });
return;
} }
} else {
if (newURL.searchParams.has("action")) newURL.searchParams.delete("action");
newURL.searchParams.append("action", "edit"); newURL.searchParams.append("action", "edit");
history.pushState({}, "", newURL.toString());
document.location.reload();
return;
} }
let convertUrl = url; history.pushState({}, "", newURL.toString());
if (fileInfo?.viewAccessibility?.MustConvert && fileInfo?.security?.Convert) {
const newUrl = await convertDocumentUrl(fileInfo.id);
if (newUrl) {
convertUrl = newUrl.webUrl;
}
}
history.pushState({}, "", convertUrl);
document.location.reload(); document.location.reload();
}; };