Personal project: Simple online code editor

Personal project: Simple online code editor
0

I struggle finding a good react package that allows me to implement a small online code editor in JS like in freecodecamp. Which one would you recommend?

Probably because there are so many good JS editors already and JS libraries full of editor functions to code your own to whatever level of complexity you like. There’s CodeMirror. Khan Academy open sourced their editor it’s simpler with some unique nice-to-haves. You could make a react package.

PS Content editable is the html way that lowers the barrier for building editors. Here’s a react package but you still have to build it.
https://www.npmjs.com/package/react-contenteditable

Thanks for your answer. I’m actually using CodeMirror but i struggle testing user inputs (with chai) as they often come as strings e.g:
"function sum(a, b) {return a+b}"
how to transform it it to function sum(a, b) {return a+b} so the js engine can interprets it as a real function.

I wasn’t aware that khan academy open sourced their editor I’ll take a look at it. Thanks!

This project is a very simplistic online editor that retrieve user inputs from the code editor i implemented using CodeMirror. The project is well under way but I’ve been struggling for days to found how to transform string function to be evaluated, I tried a lot of things like “eval()” or “Function” constructor but I get a lot of complicated errors I am not able to solve actually.

Does someone know how fcc handled this part? I feel discouraged :frowning: