Fixed Bug 57821. Added detect ui theme for Desktop Editors. Added change tab color for Desktop Editors
This commit is contained in:
parent
d858434750
commit
3a1a46f692
@ -1,7 +1,7 @@
|
||||
import toastr from "@docspace/components/toast/toastr";
|
||||
import isEmpty from "lodash/isEmpty";
|
||||
import omit from "lodash/omit";
|
||||
import { checkIsSSR } from "../utils";
|
||||
import { checkIsSSR, getEditorTheme } from "../utils";
|
||||
|
||||
const isSSR = checkIsSSR();
|
||||
|
||||
@ -27,14 +27,9 @@ export function regDesktop(
|
||||
domain: desktopConstants.domain,
|
||||
provider: desktopConstants.provider,
|
||||
userId: user.id,
|
||||
uiTheme: getEditorTheme(user?.theme),
|
||||
};
|
||||
|
||||
console.log(
|
||||
"regDesktop date=",
|
||||
data,
|
||||
`isEncryption=${isEncryption} keys=${keys} isEditor=${isEditor}`
|
||||
);
|
||||
|
||||
let extendedData;
|
||||
|
||||
if (isEncryption) {
|
||||
@ -88,11 +83,6 @@ export function regDesktop(
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
console.log(
|
||||
"Created window.cloudCryptoCommand",
|
||||
window.cloudCryptoCommand
|
||||
);
|
||||
}
|
||||
|
||||
window.onSystemMessage = (e) => {
|
||||
@ -117,8 +107,6 @@ export function regDesktop(
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
console.log("Created window.onSystemMessage", window.onSystemMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -630,3 +630,18 @@ export const getSystemTheme = () => {
|
||||
? ThemeKeys.DarkStr
|
||||
: ThemeKeys.BaseStr;
|
||||
};
|
||||
|
||||
export const getEditorTheme = (theme) => {
|
||||
switch (theme) {
|
||||
case ThemeKeys.BaseStr:
|
||||
return "default-light";
|
||||
case ThemeKeys.DarkStr:
|
||||
return "default-dark";
|
||||
case ThemeKeys.SystemStr: {
|
||||
const uiTheme = getSystemTheme();
|
||||
return uiTheme === ThemeKeys.DarkStr ? "default-dark" : "default-light";
|
||||
}
|
||||
default:
|
||||
return "default-dark";
|
||||
}
|
||||
};
|
||||
|
@ -22,15 +22,13 @@ import {
|
||||
import { EditorWrapper } from "../components/StyledEditor";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import withDialogs from "../helpers/withDialogs";
|
||||
import { assign, frameCallEvent } from "@docspace/common/utils";
|
||||
import { assign, frameCallEvent, getEditorTheme } from "@docspace/common/utils";
|
||||
import toastr from "@docspace/components/toast/toastr";
|
||||
import { DocumentEditor } from "@onlyoffice/document-editor-react";
|
||||
import ErrorContainer from "@docspace/common/components/ErrorContainer";
|
||||
import DeepLink from "./DeepLink";
|
||||
import { getDeepLink } from "../helpers/deepLinkHelper";
|
||||
|
||||
import { getEditorTheme } from "../helpers/utils";
|
||||
|
||||
toast.configure();
|
||||
|
||||
const onSDKInfo = (event) => {
|
||||
|
@ -83,21 +83,3 @@ export const initI18n = (initialI18nStoreASC) => {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const getEditorTheme = (theme) => {
|
||||
switch (theme) {
|
||||
case "Base":
|
||||
return "theme-light";
|
||||
case "Dark":
|
||||
return "theme-dark";
|
||||
case "System":
|
||||
const uiTheme =
|
||||
window?.matchMedia &&
|
||||
window?.matchMedia("(prefers-color-scheme: dark)").matches
|
||||
? "theme-dark"
|
||||
: "theme-light";
|
||||
return uiTheme;
|
||||
default:
|
||||
return "theme-dark";
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user