feature
There's no longer a way to give programmatically focus to the content-editable element.
In slate 0.4x it was possibile to attach a ref to the <Editor> component. This is no longer the case because <Editable> is a stateless component
Slate: 0.57.0
Browser: all
OS: all
It should be possible to give focus programmatically to the editor
Isn't ReactEditor.focus function does what you want to achieve?
@Killavus no idea because it's basically undocumented and I didn't know it existed. I'll try it.
@Killavus yep it works, thanks!
Is this documented anywhere?
@MarkPare I found that you can import ReactEditor from slate-react and it has a focus method. Here is how you can use it.
import { ReactEditor } from 'slate-react';
ReactEditor.focus(editor);
With editor being an instance of your editor. You can get it from createEditor() or useSlate() depending on where do you need it.
This really needs to be documented...
Most helpful comment
Is this documented anywhere?