josdejong / svelte-jsoneditor

A web-based tool to view, edit, format, repair, query, transform, and validate JSON
https://jsoneditoronline.org
Other
818 stars 108 forks source link

Why does the onChange cursor automatically jump to the beginning; #293

Closed EasonBeaty closed 11 months ago

EasonBeaty commented 11 months ago

onChange={(value) => { this.setState({text:XXXX}) }}

josdejong commented 11 months ago

How can I reproduce your issue?

It looks like your updating the state with set rather than update.

EasonBeaty commented 11 months ago

I figured out that the reason should be that after the set is re-rendered by the component, the cursor will automatically go to the beginning position

EasonBeaty commented 11 months ago

I used other method to achieve it and now it's ok