set rte focus after toolbar click

This commit is contained in:
Shawn Erquhart 2017-06-21 17:08:53 -04:00
parent 22a8da11a4
commit bc721337de

View File

@ -260,7 +260,7 @@ export default class Editor extends Component {
handleMarkClick = (event, type) => {
event.preventDefault();
const resolvedState = this.state.editorState.transform().toggleMark(type).apply();
const resolvedState = this.state.editorState.transform().focus().toggleMark(type).apply();
this.ref.onChange(resolvedState);
this.setState({ editorState: resolvedState });
};
@ -268,7 +268,7 @@ export default class Editor extends Component {
handleBlockClick = (event, type) => {
event.preventDefault();
let { editorState } = this.state;
const transform = editorState.transform();
const transform = editorState.transform().focus();
const doc = editorState.document;
const isList = this.hasBlock('list-item')
@ -306,7 +306,7 @@ export default class Editor extends Component {
}
}
const resolvedState = transform.focus().apply();
const resolvedState = transform.apply();
this.ref.onChange(resolvedState);
this.setState({ editorState: resolvedState });
};