scniro / react-codemirror2

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

Export codemirror instance #165

Closed GabrieleC closed 4 years ago

GabrieleC commented 4 years ago

Hi @scniro, I need to invoke a method (registerHelper) on the codemirror object encapsulated in the React component. This PR exports the cm instance to make this possible.

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.05%) to 81.22% when pulling daf10372d50b578959f5582e9c49b4c2ab55e542 on GabrieleC:master into a633e7dd673ddf5bdb07e2ed664a03aa47159bfa on scniro:master.

scniro commented 4 years ago

@GabrieleC 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.

fongandrew commented 4 years ago

@GabrieleC Just doing some clean up. Is this request still needed? Can you just require codemirror directly and use that? From what I can tell on this PR, it's just re-exporting the exact contents of require('codemirror').

GabrieleC commented 4 years ago

@GabrieleC Just doing some clean up. Is this request still needed? Can you just require codemirror directly and use that? From what I can tell on this PR, it's just re-exporting the exact contents of require('codemirror').

You're right, I didn't understand how to use it.

elsigh commented 4 years ago

I basically did this ala

if (typeof window !== "undefined" && typeof window.navigator !== "undefined") {
  const codemirror = require("codemirror");
  require("codemirror/addon/mode/simple");
  ...