1

I'm trying to find a reliable way to find out if the slate editor is currenty focused or not. The editor should be in a focused state even when nested elements are selected.

I've tried

ReactEditor.isFocused(editor)

But am seing really inconsistent results. Often this will yield true even if the editor is not selected. Also, no rerender seems to be triggered when the editor focus changes.

Is there a reliable way to do this?

Xen_mar
  • 8,330
  • 11
  • 51
  • 74

1 Answers1

1

Have you tried useFocused hook from Slate?

https://docs.slatejs.org/libraries/slate-react#usefocused

Alik Rakhmonov
  • 111
  • 1
  • 3