소스 검색

Wrap dispatchSelectionAndScroll in setTimeout (#22596)

GitOrigin-RevId: 8c2c27acdbbf0e8879978e307ccf952c1be5381e
Alf Eaton 1 년 전
부모
커밋
e1f880a62b
1개의 변경된 파일과 6개의 추가작업 그리고 5개의 파일을 삭제
  1. 6 5
      services/web/frontend/js/features/source-editor/extensions/cursor-position.ts

+ 6 - 5
services/web/frontend/js/features/source-editor/extensions/cursor-position.ts

@@ -122,12 +122,13 @@ const dispatchSelectionAndScroll = (
   view: EditorView,
   selection: SelectionRange
 ) => {
-  view.dispatch({
-    selection,
-    effects: EditorView.scrollIntoView(selection, { y: 'center' }),
+  window.setTimeout(() => {
+    view.dispatch({
+      selection,
+      effects: EditorView.scrollIntoView(selection, { y: 'center' }),
+    })
+    view.focus()
   })
-
-  view.focus()
 }
 
 export const setCursorLineAndScroll = (