This commit is contained in:
Vanessa 2024-12-18 20:58:31 +08:00
parent 1be47953b8
commit 812a5e392a
4 changed files with 9 additions and 53 deletions

View file

@ -139,17 +139,17 @@ export const isMac = () => {
};
export const isWin11 = async () => {
if (!navigator.userAgentData || !navigator.userAgentData.getHighEntropyValues) {
if (!(navigator as any).userAgentData || !(navigator as any).userAgentData.getHighEntropyValues) {
return false;
}
const ua = await navigator.userAgentData.getHighEntropyValues(["platformVersion"])
if (navigator.userAgentData.platform === "Windows") {
if (parseInt(ua.platformVersion.split('.')[0]) >= 13) {
return true
const ua = await (navigator as any).userAgentData.getHighEntropyValues(["platformVersion"]);
if ((navigator as any).userAgentData.platform === "Windows") {
if (parseInt(ua.platformVersion.split(".")[0]) >= 13) {
return true;
}
}
return false
}
return false;
};
export const isInAndroid = () => {
return window.siyuan.config.system.container === "android" && window.JSAndroid;

View file

@ -855,7 +855,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (nextSibling.nodeType === 3 && nextSibling.textContent === Constants.ZWSP) {
if (!nextSibling.nextSibling) {
// https://github.com/siyuan-note/siyuan/issues/13524
const nextBlockElement = getNextBlock(nodeElement)
const nextBlockElement = getNextBlock(nodeElement);
if (nextBlockElement) {
removeBlock(protyle, nextBlockElement, range, "remove");
}

View file

@ -1,44 +0,0 @@
// WICG Spec: https://wicg.github.io/ua-client-hints
declare interface Navigator extends NavigatorUA {}
declare interface WorkerNavigator extends NavigatorUA {}
// https://wicg.github.io/ua-client-hints/#navigatorua
declare interface NavigatorUA {
readonly userAgentData?: NavigatorUAData;
}
// https://wicg.github.io/ua-client-hints/#dictdef-navigatoruabrandversion
interface NavigatorUABrandVersion {
readonly brand: string;
readonly version: string;
}
// https://wicg.github.io/ua-client-hints/#dictdef-uadatavalues
interface UADataValues {
readonly brands?: NavigatorUABrandVersion[];
readonly mobile?: boolean;
readonly platform?: string;
readonly architecture?: string;
readonly bitness?: string;
readonly formFactor?: string[];
readonly model?: string;
readonly platformVersion?: string;
/** @deprecated in favour of fullVersionList */
readonly uaFullVersion?: string;
readonly fullVersionList?: NavigatorUABrandVersion[];
readonly wow64?: boolean;
}
// https://wicg.github.io/ua-client-hints/#dictdef-ualowentropyjson
interface UALowEntropyJSON {
readonly brands: NavigatorUABrandVersion[];
readonly mobile: boolean;
readonly platform: string;
}
// https://wicg.github.io/ua-client-hints/#navigatoruadata
interface NavigatorUAData extends UALowEntropyJSON {
getHighEntropyValues(hints: string[]): Promise<UADataValues>;
toJSON(): UALowEntropyJSON;
}

View file

@ -225,7 +225,7 @@ export const setInlineStyle = async (set = true) => {
src: local("Apple Color Emoji"),
local("Segoe UI Emoji"),
local("Segoe UI Symbol");
}`
}`;
} else {
const isWin11Browser = await isWin11();
if (isWin11Browser) {