RME upgrade, fix autoFocus logic

This commit is contained in:
Tom Moor
2018-08-16 22:51:51 -07:00
parent c140c64346
commit be09b290b7
4 changed files with 14 additions and 5 deletions

View File

@@ -41,10 +41,20 @@ schema.document.normalize = (
class Editor extends React.Component<Props> {
editor: *;
componentDidMount() {
if (!this.props.defaultValue) {
this.focusAtStart();
}
}
setEditorRef = (ref: RichMarkdownEditor) => {
this.editor = ref;
};
focusAtStart = () => {
if (this.editor) this.editor.focusAtStart();
};
focusAtEnd = () => {
if (this.editor) this.editor.focusAtEnd();
};