Panel: Editor theme can't change (#99621)

editor theme can't change
This commit is contained in:
jackyin
2025-02-11 09:51:59 +02:00
committed by GitHub
parent e4ef71b78e
commit f2d34254d3
@@ -1,6 +1,6 @@
import Editor, { loader as monacoEditorLoader, Monaco } from '@monaco-editor/react'; import Editor, { loader as monacoEditorLoader, Monaco } from '@monaco-editor/react';
import * as monaco from 'monaco-editor'; import * as monaco from 'monaco-editor';
import { useCallback } from 'react'; import { useCallback, useEffect } from 'react';
import { useTheme2 } from '../../themes'; import { useTheme2 } from '../../themes';
@@ -16,12 +16,15 @@ export const ReactMonacoEditor = (props: ReactMonacoEditorProps) => {
const theme = useTheme2(); const theme = useTheme2();
const onMonacoBeforeMount = useCallback( const onMonacoBeforeMount = useCallback(
(monaco: Monaco) => { (monaco: Monaco) => {
defineThemes(monaco, theme);
beforeMount?.(monaco); beforeMount?.(monaco);
}, },
[beforeMount, theme] [beforeMount]
); );
useEffect(() => {
defineThemes(monaco, theme);
}, [theme]);
return ( return (
<Editor <Editor
{...restProps} {...restProps}