Created
February 16, 2020 10:31
-
-
Save gustav1105/32559882f835416a4c7b510789945f07 to your computer and use it in GitHub Desktop.
editor-state-and-focus-functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const editor = React.useRef<Editor>(null); | |
const [editorState, setEditorState] = React.useState<EditorState>( | |
EditorState.createEmpty( | |
new CompositeDecorator([ | |
{ | |
strategy: linkStrategy, | |
component: DecoratedLink | |
} | |
]) | |
) | |
); | |
const focusEditor = React.useCallback(() => { | |
if (editor.current) { | |
editor.current.focus(); | |
} | |
}, [editor]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment