[cm6] Add scrollIntoView when commands are dispatched (#11678)

GitOrigin-RevId: be005885330b9b29c7ddbfeacaec0a41d96e5e25
This commit is contained in:
Alf Eaton 2023-04-14 09:59:31 +01:00 committed by Copybot
parent 7d237d0103
commit 63b2064420
3 changed files with 12 additions and 6 deletions

View file

@ -67,7 +67,8 @@ export const wrapRanges =
}, },
], ],
} }
}) }),
{ scrollIntoView: true }
) )
return true return true
} }
@ -753,7 +754,8 @@ export function toggleRanges(command: string) {
// Shouldn't happen, but default to just wrapping the content // Shouldn't happen, but default to just wrapping the content
return wrapRangeInCommand(view.state, range, command) return wrapRangeInCommand(view.state, range, command)
}) }),
{ scrollIntoView: true }
) )
return true return true
} }

View file

@ -87,7 +87,8 @@ const wrapRangesInList =
view.dispatch( view.dispatch(
view.state.changeByRange(range => view.state.changeByRange(range =>
wrapRangeInList(view.state, range, environment) wrapRangeInList(view.state, range, environment)
) ),
{ scrollIntoView: true }
) )
return true return true
} }
@ -182,7 +183,8 @@ const unwrapRangesFromList =
view.dispatch( view.dispatch(
view.state.changeByRange(range => view.state.changeByRange(range =>
unwrapRangeFromList(view.state, range, environment) unwrapRangeFromList(view.state, range, environment)
) ),
{ scrollIntoView: true }
) )
return true return true
} }
@ -306,7 +308,8 @@ export const toggleListForRanges =
view.dispatch( view.dispatch(
view.state.changeByRange(range => view.state.changeByRange(range =>
toggleListForRange(view, range, environment) toggleListForRange(view, range, environment)
) ),
{ scrollIntoView: true }
) )
} }

View file

@ -134,6 +134,7 @@ export const setSectionHeadingLevel = (view: EditorView, level: string) => {
changes, changes,
} }
} }
}) }),
{ scrollIntoView: true }
) )
} }