From 27551df63977b4815e609f4e22ffa19bf5cddf85 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Tue, 15 Jun 2021 08:21:11 -0700 Subject: [PATCH] Handle focusing on the editor line ourselves :shrug:; fixes #39 --- src/TextEditor.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/TextEditor.js b/src/TextEditor.js index 536ba33..8e77779 100644 --- a/src/TextEditor.js +++ b/src/TextEditor.js @@ -20,6 +20,12 @@ class TextEditor extends Component { this.onChange = this.onChange.bind(this); this.handleKeyCommand = this.handleKeyCommand.bind(this); this.handleFormating = this.handleFormating.bind(this); + this.handleFocus = this.handleFocus.bind(this); + this.editorRef = React.createRef(); + } + + handleFocus() { + if (this.editorRef.current) this.editorRef.current.focus(); } /** */ @@ -58,6 +64,7 @@ class TextEditor extends Component { const { classes } = this.props; const { editorState } = this.state; const currentStyle = editorState.getCurrentInlineStyle(); + return (
-
+