Closed sipp11 closed 6 years ago
I have tried setting props to cursor & scroll but it doesn't seem to get <CodeMirror /> to move at all.
cursor
scroll
<CodeMirror />
import { Controlled as CodeMirror } from 'react-codemirror2'; <CodeMirror className="content" value={this.state.fullText} options={options} cursor={cursor} scroll={this.state.scroll} onBeforeChange={(editor, data, value) => { this.setState({ fullText: value }); }} onChange={this.updateCode.bind(this)} onCursor={this.updateCursor.bind(this)} onScroll={this.handleOnScroll.bind(this)} />
Every event initiated by my cursor can be captured, but when I change cursor or scroll programmatically, nothing changes.
I would be appreciated if you could guide me what I'm missing.
Oh I think I could get it work now. #40 has all this information.
editor.scrollTo(0, 40); editor.setCursor({ line: 10, ch: 0 });
This works great. 👍
I have tried setting props to
cursor
&scroll
but it doesn't seem to get<CodeMirror />
to move at all.Every event initiated by my cursor can be captured, but when I change
cursor
orscroll
programmatically, nothing changes.I would be appreciated if you could guide me what I'm missing.