1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-19 05:31:56 +02:00

Fix useFocused not updated when calling ReactEditor.focus (#5593)

This commit is contained in:
Joe Anderson
2024-01-24 14:05:16 +00:00
committed by GitHub
parent 8f2ad02db3
commit 54594d0f81
2 changed files with 8 additions and 1 deletions

View File

@@ -447,8 +447,10 @@ export const ReactEditor: ReactEditorInterface = {
Transforms.select(editor, Editor.start(editor, []))
editor.onChange()
}
el.focus({ preventScroll: true })
// IS_FOCUSED should be set before calling el.focus() to ensure that
// FocusedContext is updated to the correct value
IS_FOCUSED.set(editor, true)
el.focus({ preventScroll: true })
}
},