fix(playground): ensure editor focus and position handling only occurs if editor is initialized

This commit is contained in:
ngc2207 2025-01-05 03:28:52 +08:00
parent 3737a708f6
commit 0bc5758d44

View File

@ -117,6 +117,7 @@ export default function PlaygroundPage() {
options={{ automaticLayout: true }}
onMount={(editor) => {
editorRef.current = editor;
if (editorRef.current) {
const model = editorRef.current.getModel();
if (model) {
const lineCount = model.getLineCount();
@ -127,6 +128,7 @@ export default function PlaygroundPage() {
});
editorRef.current.focus();
}
}
}}
/>
</div>