Closed lightninglu10 closed 6 years ago
addLineClass
is a command. Please try persisting the instance. Anything you can do with the codemirror API, you can do manually.
Hey @scniro, your link isn't working. Are you talking about persisting the instance like this?
But anyawys, it looks like that works!
For anyone who runs into this issue as well, you should use the
editorDidMount={(editor) => this.codeMirrorEditor = editor}
prop instead of trying to set a ref!
In the docs, there's an api for addLineClass: http://codemirror.net/doc/manual.html#addLineClass
This works in the editor here: http://codemirror.net/demo/activeline.html
Open inspect element and type into the console: editor.addLineClass(10, 'wrap', 'newClassName'), and you'll see that line 10 gets the newClassName attached to the wrapper.
But when I try it with react-codemirror2, this doesn't happen. Is a prop being passed incorrectly as class instead of className somewhere?