JedWatson/react-codemirror

Cursor moves to beginning of document after typing

lightninglu10 opened this issue · 4 comments

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

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

having the same problem. version 5.37.0

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

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 => {}}
/>