How to use the slate-react.ReactEditor.focus function in slate-react

To help you get started, we’ve selected a few slate-react examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github redwood / redwood / demos / desktop-chat-app / frontend / src / components / Chat.jsx View on Github external
Transforms.insertNodes(editor, [emojiNode, {
          text: ' '
        }])
        Transforms.move(editor, { distance: 2 })
      } else {
        // Set focus point from blurred
        editor.selection = { anchor: editorFocusPoint, focus: editorFocusPoint }
        const emojiNode = {
          type: 'emoji',
          value: emoji.colons,
          children: [{ text: '' }],
        }
        Transforms.insertNodes(editor, emojiNode)
        Transforms.move(editor, { distance: 1 })

        ReactEditor.focus(editor)
        setShowEmojiKeyboard(false)
      }
    }