Skip to content

Commit

Permalink
fixed spectra syntax on theme change
Browse files Browse the repository at this point in the history
  • Loading branch information
soaibsafi committed Jun 5, 2024
1 parent ac63513 commit 19b94c2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions frontend/src/components/Playground/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 19b94c2

Please sign in to comment.