JedWatson / react-codemirror

Codemirror Component for React.js
MIT License
1.55k stars 262 forks source link

Cursor moves to beginning of document after typing #137

Open lightninglu10 opened 6 years ago

lightninglu10 commented 6 years ago

Super weird behavior, after i load some code into the editor, and then type something, the cursor goes back to the first line in the editor:

screen shot 2018-02-12 at 5 47 42 pm screen shot 2018-02-12 at 5 47 46 pm
Younguser commented 6 years ago

I've saw the same problem. Do you solve it?

mjbradford89 commented 6 years ago

having the same problem. version 5.37.0

lightninglu10 commented 6 years ago

This library doesn't seem to be maintained anymore, so I used https://github.com/scniro/react-codemirror2 instead.

fahad39 commented 1 year ago

Instead of updating content in onChange props try using onblur <JoditEditor ref={editor} value={content} config={config} tabIndex={1} // tabIndex of textarea onBlur={newContent => setContent(newContent)} // preferred to use only this option to update the content for performance reasons onChange={newContent => {}} />