From 541c29ee2bc2bbace435bde96d6c9576204fd327 Mon Sep 17 00:00:00 2001 From: armano2 Date: Tue, 26 Apr 2022 13:56:35 +0200 Subject: [PATCH] fix(website): correct theme color blink when playground is initialized #4869 --- packages/website/src/components/editor/useSandboxServices.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/website/src/components/editor/useSandboxServices.ts b/packages/website/src/components/editor/useSandboxServices.ts index 9e07408cc3f8..3fe7d7e1ddcb 100644 --- a/packages/website/src/components/editor/useSandboxServices.ts +++ b/packages/website/src/components/editor/useSandboxServices.ts @@ -10,6 +10,7 @@ import type { import { sandboxSingleton } from './loadSandbox'; import { editorEmbedId } from './EditorEmbed'; +import { useColorMode } from '@docusaurus/theme-common'; export interface SandboxServicesProps { readonly jsx?: boolean; @@ -34,6 +35,7 @@ export const useSandboxServices = ( ): Error | SandboxServices | undefined => { const [services, setServices] = useState(); const [loadedTs, setLoadedTs] = useState(props.ts); + const { isDarkTheme } = useColorMode(); useEffect(() => { if (props.ts !== loadedTs) { @@ -74,6 +76,9 @@ export const useSandboxServices = ( main, ts, ); + sandboxInstance.monaco.editor.setTheme( + isDarkTheme ? 'vs-dark' : 'vs-light', + ); const libMap = await sandboxInstance.tsvfs.createDefaultMapFromCDN( sandboxInstance.getCompilerOptions(), pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy