Skip to content

Commit

Permalink
Closes #282: Improve React ref (#283)
Browse files Browse the repository at this point in the history
* Closes #282: Improve ref

* Fix eslint errors

* Update flow validations for editor
  • Loading branch information
vestimir authored and sstur committed May 18, 2018
1 parent a3c1dcd commit f10c0e5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/RichTextEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type Props = {
export default class RichTextEditor extends Component {
props: Props;
_keyEmitter: EventEmitter;
editor: HTMLDivElement;

constructor() {
super(...arguments);
Expand Down Expand Up @@ -145,7 +146,9 @@ export default class RichTextEditor extends Component {
onTab={this._onTab}
onChange={this._onChange}
placeholder={placeholder}
ref="editor"
ref={(el) => {
this.editor = el;
}}
spellCheck={true}
readOnly={readOnly}
/>
Expand Down Expand Up @@ -328,7 +331,7 @@ export default class RichTextEditor extends Component {
}

_focus() {
this.refs.editor.focus();
this.editor.focus();
}
}

Expand Down

0 comments on commit f10c0e5

Please sign in to comment.