react-codemirror icon indicating copy to clipboard operation
react-codemirror copied to clipboard

Cursor moves to beginning of document after typing

Open lightninglu10 opened this issue 7 years ago • 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

lightninglu10 avatar Feb 13 '18 01:02 lightninglu10

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

Younguser avatar Apr 10 '18 07:04 Younguser

having the same problem. version 5.37.0

mjbradford89 avatar Apr 24 '18 22:04 mjbradford89

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

lightninglu10 avatar Apr 24 '18 22:04 lightninglu10

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

fahad39 avatar Jan 16 '23 13:01 fahad39