mirror of
https://litchi.icu/ngc2207/judge.git
synced 2025-05-18 23:16:45 +00:00
fix(playground): ensure editor focus and position handling only occurs if editor is initialized
This commit is contained in:
parent
3737a708f6
commit
0bc5758d44
@ -117,6 +117,7 @@ export default function PlaygroundPage() {
|
|||||||
options={{ automaticLayout: true }}
|
options={{ automaticLayout: true }}
|
||||||
onMount={(editor) => {
|
onMount={(editor) => {
|
||||||
editorRef.current = editor;
|
editorRef.current = editor;
|
||||||
|
if (editorRef.current) {
|
||||||
const model = editorRef.current.getModel();
|
const model = editorRef.current.getModel();
|
||||||
if (model) {
|
if (model) {
|
||||||
const lineCount = model.getLineCount();
|
const lineCount = model.getLineCount();
|
||||||
@ -127,6 +128,7 @@ export default function PlaygroundPage() {
|
|||||||
});
|
});
|
||||||
editorRef.current.focus();
|
editorRef.current.focus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user