From 812a5e392a8143bb708a650f08c20d36c4794d13 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 18 Dec 2024 20:58:31 +0800 Subject: [PATCH] :rotating_light: --- app/src/protyle/util/compatibility.ts | 14 ++++----- app/src/protyle/wysiwyg/keydown.ts | 2 +- app/src/types/user-agent.d.ts | 44 --------------------------- app/src/util/assets.ts | 2 +- 4 files changed, 9 insertions(+), 53 deletions(-) delete mode 100644 app/src/types/user-agent.d.ts diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts index d6b425be9..595a1f122 100644 --- a/app/src/protyle/util/compatibility.ts +++ b/app/src/protyle/util/compatibility.ts @@ -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; diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index 86cc1c908..6771f0b86 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -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"); } diff --git a/app/src/types/user-agent.d.ts b/app/src/types/user-agent.d.ts deleted file mode 100644 index 1f4ba7c12..000000000 --- a/app/src/types/user-agent.d.ts +++ /dev/null @@ -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; - toJSON(): UALowEntropyJSON; -} diff --git a/app/src/util/assets.ts b/app/src/util/assets.ts index 37163eb89..2f4de4b6d 100644 --- a/app/src/util/assets.ts +++ b/app/src/util/assets.ts @@ -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) {