mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 15:26:33 +00:00
fix(code-editor): ensure localStorage access is safe in non-browser environments
This commit is contained in:
parent
8be38cee1d
commit
524cce5a73
@ -197,8 +197,10 @@ export default function CodeEditor() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function handleEditorChange(value: string | undefined) {
|
function handleEditorChange(value: string | undefined) {
|
||||||
|
if (typeof window !== "undefined") {
|
||||||
localStorage.setItem(`code-editor-value-${language}`, value ?? "");
|
localStorage.setItem(`code-editor-value-${language}`, value ?? "");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const editorValue =
|
const editorValue =
|
||||||
typeof window !== "undefined"
|
typeof window !== "undefined"
|
||||||
|
Loading…
Reference in New Issue
Block a user