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:
parent
2aad778872
commit
a90aff601d
@ -81,30 +81,31 @@ export const onSDKRequestEditRights = async (
|
||||
const url = window.location.href;
|
||||
const isPDF = documentType === "pdf";
|
||||
|
||||
if (isPDF) {
|
||||
const newURL = new URL(url);
|
||||
let newURL = new URL(url);
|
||||
|
||||
if (newURL.searchParams.has("action")) {
|
||||
newURL.searchParams.delete("action");
|
||||
if (
|
||||
!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");
|
||||
}
|
||||
|
||||
newURL.searchParams.append("action", "edit");
|
||||
|
||||
history.pushState({}, "", newURL.toString());
|
||||
document.location.reload();
|
||||
|
||||
} catch (error) {
|
||||
console.error("Error converting document", { error });
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (newURL.searchParams.has("action")) newURL.searchParams.delete("action");
|
||||
|
||||
let convertUrl = url;
|
||||
newURL.searchParams.append("action", "edit");
|
||||
}
|
||||
|
||||
if (fileInfo?.viewAccessibility?.MustConvert && fileInfo?.security?.Convert) {
|
||||
const newUrl = await convertDocumentUrl(fileInfo.id);
|
||||
if (newUrl) {
|
||||
convertUrl = newUrl.webUrl;
|
||||
}
|
||||
}
|
||||
history.pushState({}, "", convertUrl);
|
||||
history.pushState({}, "", newURL.toString());
|
||||
document.location.reload();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user