Skip to content

Commit

Permalink
Focus on RichText when selection changes
Browse files Browse the repository at this point in the history
  • Loading branch information
koke committed Nov 29, 2018
1 parent 2a66db0 commit aa13375
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/editor/src/components/rich-text/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,18 @@ export class RichText extends Component {
return true;
}

componentDidMount() {
if ( this.props.isSelected ) {
this._editor.focus();
}
}

componentDidUpdate( prevProps ) {
if ( this.props.isSelected && ! prevProps.isSelected ) {
this._editor.focus();
}
}

isFormatActive( format ) {
return this.state.formats[ format ] && this.state.formats[ format ].isActive;
}
Expand Down

0 comments on commit aa13375

Please sign in to comment.