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

Expose CodeMirror library

Open romines opened this issue 9 years ago • 3 comments

I'm trying to use Firebase's Firepad with this component. Firepad is expecting a global CodeMirror object, which it doesn't find unless I include the library separately. Perhaps it is a given that this conflicts with this component? Is there a way to expose the CodeMirror library within a component, so that it is available to Firepad? Apologies if this is the wrong place to ask this.

romines avatar Jan 10 '16 23:01 romines

this.refs.editor.getCodeMirror() if you have bound your codemirror instance through ref="editor".

Edit: I just noticed #33. It seems the CodeMirror instance returned isn't a full instance...

guidobouman avatar Feb 08 '16 15:02 guidobouman

Incase anyone is looking at the issue, continuing on @guidobouman's statement, you can now use: this.refs.editor.getCodeMirrorInstance() to get the full CodeMirror instance, not just the editor.

For universal apps you can do something like: global.CodeMirror = this.refs.editor.getCodeMirrorInstance();

TheUltDev avatar Oct 22 '16 22:10 TheUltDev

If this issue still persists please give react-codemirror2 a look. I'm planning on maintaining this moving forward. Better docs will be coming. Feel free to open up any issues/suggestions as I'll be trying to gather as much constructive feedback from the community moving forward

scniro avatar Jun 02 '17 11:06 scniro