_insertText() {
const editorState = this.state.editorState;
const selection = editorState.getSelection();
const contentState = editorState.getCurrentContent();
const ncs = Modifier.insertText(contentState, selection, "wefoiwjoefjwoiefjoiwjefio");
const es = EditorState.push(editorState, ncs, 'insert-fragment');
this.setState(es);
}
With above codes, i can't get the wef.... to be append to the end. I have work on this problem for hours, but still can't found the solution. The above code is written according to Tex sample.
It's not a bug.
I found the solution.
My init method is
getInitialState() {
return {
editorState: EditorState.createEmpty()
};
},
So when i want to update editorState i need to call this.setState({editorState: es}), not this.setState(es). Really love this framework, thank you.
how to append to the end?
Most helpful comment
I found the solution.
My init method is
So when i want to update
editorStatei need to callthis.setState({editorState: es}), notthis.setState(es). Really love this framework, thank you.