Doceditor: fix iphone problems

This commit is contained in:
Timofey Boyko 2024-02-27 12:49:11 +03:00
parent d84a4b3bef
commit eebbb68734
5 changed files with 23 additions and 22 deletions

View File

@ -48,6 +48,7 @@ const Root = ({
isSharingAccess,
editorUrl,
doc,
fileId,
}: TResponse) => {
const documentserverUrl = editorUrl?.docServiceUrl;
const fileInfo = config?.file;
@ -121,7 +122,7 @@ const Root = ({
i18n={i18n}
onError={onError}
>
{!fileInfo?.id ? (
{!fileId ? (
<AppLoader />
) : isShowDeepLink ? (
<DeepLink
@ -139,8 +140,8 @@ const Root = ({
customizedBodyText={getErrorMessage()}
isEditor
/>
) : (
<>
) : isShowDeepLink ? null : (
<div style={{ width: "100%", height: "100%" }}>
{config && user && documentserverUrl && fileInfo && (
<Editor
config={config}
@ -196,7 +197,7 @@ const Root = ({
i18n={i18n}
/>
)}
</>
</div>
)}
</ErrorBoundary>
</ThemeProvider>

View File

@ -16,6 +16,7 @@ const useError = ({ error, editorUrl, t }: UseErrorProps) => {
React.useEffect(() => {
if (error?.message === "unauthorized") {
sessionStorage.setItem("referenceUrl", window.location.href);
window.open(
combineUrl(window.DocSpaceConfig?.proxy?.url, "/login"),
"_self",

View File

@ -16,8 +16,7 @@ import { TSelectedFileInfo } from "@docspace/shared/selectors/Files/FilesSelecto
import SocketIOHelper from "@docspace/shared/utils/socket";
import { FilesSelectorFilterTypes } from "@docspace/shared/enums";
import { TRoomSecurity } from "@docspace/shared/api/rooms/types";
import { Nullable, TPathParts, TTranslation } from "@docspace/shared/types";
import { TTheme } from "@docspace/shared/themes";
import { Nullable, TTranslation } from "@docspace/shared/types";
import { i18n } from "i18next";
export type TGoBack = {
@ -158,6 +157,7 @@ export type TResponse =
isSharingAccess: boolean;
error?: TError;
doc?: string;
fileId?: string;
}
| {
error: TError;
@ -168,6 +168,7 @@ export type TResponse =
successAuth?: undefined;
isSharingAccess?: undefined;
doc?: undefined;
fileId?: string;
};
export type EditorProps = {

View File

@ -79,6 +79,7 @@ export async function getData(
successAuth: false,
isSharingAccess: false,
doc,
fileId,
};
// needed to reset rtl language in Editor
@ -110,7 +111,7 @@ export async function getData(
return response;
}
const response: TResponse = { error: { message: "unauthorized" } };
const response: TResponse = { error: { message: "unauthorized" }, fileId };
return response;
} catch (e) {

View File

@ -1,5 +1,5 @@
import React, { ErrorInfo } from "react";
import { ThemeProvider } from "styled-components";
import { I18nextProvider } from "react-i18next";
import Error520 from "../errors/Error520";
@ -27,7 +27,6 @@ class ErrorBoundary extends React.Component<
// You can also log the error to an error reporting service
// eslint-disable-next-line no-console
console.error(error, errorInfo);
const { onError } = this.props;
onError?.();
@ -53,19 +52,17 @@ class ErrorBoundary extends React.Component<
if (isNextJS && theme && i18n) {
return (
<ThemeProvider theme={theme}>
<I18nextProvider i18n={i18n}>
<Error520
user={user}
errorLog={error}
version={version}
firebaseHelper={firebaseHelper}
currentDeviceType={currentDeviceType}
whiteLabelLogoUrls={whiteLabelLogoUrls}
currentColorScheme={theme.currentColorScheme}
/>
</I18nextProvider>
</ThemeProvider>
<I18nextProvider i18n={i18n}>
<Error520
user={user}
errorLog={error}
version={version}
firebaseHelper={firebaseHelper}
currentDeviceType={currentDeviceType}
whiteLabelLogoUrls={whiteLabelLogoUrls}
currentColorScheme={theme.currentColorScheme}
/>
</I18nextProvider>
);
}
return (