mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-30 12:24:25 +02:00
Focus the editor after using the "Switch to editor" button (#21549)
GitOrigin-RevId: f94c6d266ec9c2c3e4a30ea2c34c937817b48596
This commit is contained in:
@@ -20,6 +20,9 @@ function SwitchToEditorButton() {
|
||||
|
||||
function handleClick() {
|
||||
setView('editor')
|
||||
window.setTimeout(() => {
|
||||
window.dispatchEvent(new Event('editor:focus'))
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -576,6 +576,13 @@ function useCodeMirrorScope(view: EditorView) {
|
||||
|
||||
useEventListener('learnedWords:reset', handleResetLearnedWords)
|
||||
|
||||
useEventListener(
|
||||
'editor:focus',
|
||||
useCallback(() => {
|
||||
view.focus()
|
||||
}, [view])
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
view.dispatch(reviewPanelToggled())
|
||||
}, [reviewPanelOpen, miniReviewPanelVisible, view])
|
||||
|
||||
Reference in New Issue
Block a user