wangzuo / react-medium-editor

React wrapper for medium-editor
https://wangzuo.github.io/react-medium-editor
MIT License
504 stars 93 forks source link

Serving text from redux state causes it to be typed vice versa #18

Open xzilja opened 8 years ago

xzilja commented 8 years ago

I am updating text in my redux state onChange within an editor, due to this editors text is now set from redux state, every time it changes the typing cursor jumps to the beginning resulting in text that is typed vice versa.

This is my related stackoverflow post.

wangzuo commented 8 years ago

Not quite sure how redux works with this, maybe more code sample would help.

xzilja commented 8 years ago

@wangzuo Well, essentially with redux I want to preserver state onChange of the <Editor> component. to do so I call a function that onChange pases current text of the editor to redux state, once redux state it updated it also updates state of editor component as well with contents from redux, such state is used liketext=this.state.text in the editor. Component re renders on change, this causes that blinking line cursor that is usually at the end of the text, jump to the beginning of the text (so think of prepending text) where it should ideally append any new changes.