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

Codemirror support for react v18?

Open MielkeDaniel opened this issue 2 years ago • 17 comments

Has someone discovered a way to run codemirror in react v18? I rather do not want to downgrade my react version again...

MielkeDaniel avatar Oct 14 '22 14:10 MielkeDaniel

Even I am facing some issues.

kaushikc44 avatar Oct 18 '22 17:10 kaushikc44

Did you guys found a way?

curiosity110 avatar Oct 31 '22 09:10 curiosity110

Naaah not explicitly. If you want to use Codemirror via React you can not use this library. You´ll have to integrate the "normal" codemirror yourself. I´m using the newest version (Codemirror 6) right now. You can watch some tutorials and read the docs. It´s kinda tricky to get into but all makes sense in the end.

https://codemirror.net/

Good luck

MielkeDaniel avatar Oct 31 '22 09:10 MielkeDaniel

Yes , I found a way , https://uiwjs.github.io/react-codemirror/ I used this, and it worked for me , you can check here www.codevim.tech

kaushikc44 avatar Oct 31 '22 09:10 kaushikc44

Thanks for your reply I am gonna try with this one https://uiwjs.github.io/react-codemirror/

if doens't work i am gonna build my own Thanks so much!

curiosity110 avatar Oct 31 '22 09:10 curiosity110

Thanks for your reply I am gonna try with this one https://uiwjs.github.io/react-codemirror/

if doens't work i am gonna build my own Thanks so much!

I tried that one as well. Notice that it´s not as customizable as the standard codemirror, which isn´t too much setup in the end!

MielkeDaniel avatar Oct 31 '22 10:10 MielkeDaniel

No its not , Please go through my code from here https://github.com/kaushikc44/codevim

kaushikc44 avatar Oct 31 '22 14:10 kaushikc44

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: [email protected] npm ERR! Found: [email protected] npm ERR! node_modules/react npm ERR! react@"^18.2.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@">=15.5 <=16.x" from [email protected]

I'm facing the same issue. Is there any solution that worked?

ArchanaSharma95 avatar Nov 23 '22 03:11 ArchanaSharma95

Are you using uiw / code mirror module? I have already mentioned that you prefer that., since code mirror isn't yet supported for react 18.2.0 either use a older version of react or use uiw/code mirror check the above repository codevim you can find the code for it.

kaushikc44 avatar Nov 23 '22 03:11 kaushikc44

Thanks for your reply I am gonna try with this one https://uiwjs.github.io/react-codemirror/ if doens't work i am gonna build my own Thanks so much!

I tried that one as well. Notice that it´s not as customizable as the standard codemirror, which isn´t too much setup in the end!

@MielkeDaniel https://github.com/uiwjs/react-codemirror/tree/v3

Using v3 is the old cm5 version.

jaywcjlove avatar Dec 09 '22 16:12 jaywcjlove

Please I've been on this same issue for 2 days now is there any solution yet? I'm trying to use react-codemirror2 with peer dependency codemirror on React 18.2.0 and still haven't found a way out. I appreciate your assistance in advance!

Favourz1 avatar Feb 04 '23 18:02 Favourz1

  1. Turn off your react strict mode in index.js
  2. install "react-codemirror2": "^7.2.1
  3. install "codemirror": "^5.57.0"
  4. and last one use --force while you install any packages

It's worked on react v 18 for me

7hourspg avatar Feb 17 '23 07:02 7hourspg

Thanks @7hourspg.

So I'd install the dependencies with npm i [email protected] [email protected] --force ??

Favourz1 avatar Feb 17 '23 12:02 Favourz1

npm WARN using --force Recommended protections disabled. npm WARN ERESOLVE overriding peer dependency npm WARN While resolving: [email protected]
npm WARN Found: [email protected] npm WARN node_modules/react npm WARN peer react@"^18.0.0" from @testing-library/[email protected] npm WARN node_modules/@testing-library/react
npm WARN @testing-library/react@"^13.4.0" from the root project npm WARN 3 more (react-dom, react-scripts, the root project) npm WARN npm WARN Could not resolve dependency: npm WARN peer react@">=15.5 <=16.x" from [email protected] npm WARN node_modules/react-codemirror2 npm WARN react-codemirror2@"7.2.1" from the root project npm WARN npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react npm WARN peer react@">=15.5 <=16.x" from [email protected] npm WARN node_modules/react-codemirror2 npm WARN react-codemirror2@"7.2.1" from the root project

added 2 packages, and audited 1480 packages in 8s

231 packages are looking for funding run npm fund for details

7 vulnerabilities (1 moderate, 6 high)

To address all issues (including breaking changes), run: npm audit fix --force

Run npm audit for details.

@Favourz1 , I used your command, this came up but codemirror is now installed, however are these warnings concerning or should i ignore them? (PS: I am new to React)

Dhimantwalia avatar Feb 18 '23 06:02 Dhimantwalia

  1. Turn off your react strict mode in index.js
  2. install "react-codemirror2": "^7.2.1
  3. install "codemirror": "^5.57.0"
  4. and last one use --force while you install any packages

It's worked on react v 18 for me

Thank you @7hourspg , it worked for me in React v18

Bhavika-Maurya avatar Jun 30 '23 09:06 Bhavika-Maurya

hey @7hourspg , thanks buddy for helping

ajay-nishad25 avatar Jul 22 '23 06:07 ajay-nishad25

working

khamkaradinath avatar Aug 05 '23 18:08 khamkaradinath