scniro / react-codemirror2

Codemirror integrated components for React
MIT License
1.66k stars 193 forks source link

Can't change `cursor.line` after Codemirror mounts #173

Closed stoplion closed 4 years ago

stoplion commented 4 years ago

https://codesandbox.io/s/heuristic-neumann-kvkjn

cursor={{
          line: activeLine,
          ch: 1
        }}

Is this intended? Once the component mounts, the line property seems like it can't be changed.

scniro commented 4 years ago

@stoplion I am a lot shorter on time these days as when I started this project. Codemirror & React APIs are moving to quickly for me to keep atop of for the day-to-day. I am looking for a co-maintainer of this project. Please contact me directly if you are interested. Thank you for understanding.

sukrut-gs commented 4 years ago

I will have a look at this.

sukrut-gs commented 4 years ago

@stoplion you can pass key to CodeMirror like this <CodeMirror key={activeLine} value={ one two three four } options={{ lineNumbers: true, styleActiveLine: true }} cursor={{ line: parseInt(activeLine,10), ch: 1 }} />

elsigh commented 4 years ago

looks like a workaround