From 5aa2383f26019422af84ddc4a15b4f7af9248472 Mon Sep 17 00:00:00 2001 From: geens Date: Fri, 22 Nov 2024 18:50:47 +0100 Subject: [PATCH] Fixed autoscroll with small delay --- web/src/components/editors/StandardEditor.jsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/web/src/components/editors/StandardEditor.jsx b/web/src/components/editors/StandardEditor.jsx index 1da6407..f895ed5 100644 --- a/web/src/components/editors/StandardEditor.jsx +++ b/web/src/components/editors/StandardEditor.jsx @@ -17,16 +17,15 @@ export const StandardEditor = ({ if (editorRef.current && autoScroll) { const model = editorRef.current.getModel(); const lineCount = model.getLineCount(); - editorRef.current.revealPositionInCenter({ - lineNumber: lineCount, - column: 1 - }); + editorRef.current.revealLine(lineCount, monaco.editor.ScrollType.Smooth); } }; const handleEditorDidMount = (editor) => { editorRef.current = editor; - scrollToBottom(); + setTimeout(() => { + scrollToBottom(); + }, 10); }; React.useEffect(() => {