diff --git a/frontend/src/components/Playground/Editor.jsx b/frontend/src/components/Playground/Editor.jsx index 75f07b5..8abf6e0 100644 --- a/frontend/src/components/Playground/Editor.jsx +++ b/frontend/src/components/Playground/Editor.jsx @@ -17,10 +17,6 @@ const CodeEditor = (props) => { const [internalEditorValue, setInternalEditorValue] = useState(props.editorValue); const [language, setLanguage] = useState(props.language.id); const [decorationIds, setDecorationIds] = useState([]); - const [editorTheme, setEditorTheme] = useState(()=> { - const storedTheme = localStorage.getItem('isDarkTheme'); - return storedTheme ? 'vs-dark' : 'vs'; - }); /** * Sets the editor value when the editorValue prop changes. @@ -112,6 +108,12 @@ const CodeEditor = (props) => { monaco.editor.setTheme('spectraTheme'); } + useEffect(() => { + if(editorRef.current){ + handleEditorDidMount(editorRef.current, window.monaco) + } + }, [props.editorTheme]); + /** * Gets the editor value and sets the editorValue prop. * @param {*} value