Wrap dispatchSelectionAndScroll in setTimeout (#22596)

GitOrigin-RevId: 8c2c27acdbbf0e8879978e307ccf952c1be5381e
This commit is contained in:
Alf Eaton
2025-01-08 09:16:34 +00:00
committed by Copybot
parent 45facc0f78
commit e1f880a62b

View File

@@ -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 = (