I am looking to writing a simple text editor in JavaScript. I am currently using a contenteditable
div
. But it seems very minimalistic and I am not sure if it is right component to use for a text editor. I looked at Atom and VS Code source, but I am not able to understand what they use as the base component for the editor. Could someone point me in the right direction? I could not find any html files in atom repository. Everything there is JavaScript. Where are the html files for the editor? Which component should I use as the base for a text editor (like Atom)?
Asked
Active
Viewed 650 times
2

John Doe
- 2,225
- 6
- 16
- 44
-
1These are not simple text editors, they're powerful IDEs. They almost certainly use custom editing engines, not something you'll find prepackaged in JavaScript. – Barmar Mar 10 '19 at 06:53
-
https://ace.c9.io/ - To get you started – Abijeet Patro Mar 10 '19 at 06:58
-
1Here is some info on what VSCode what created with: https://stackoverflow.com/a/29966094/3345051 – Hybrid Mar 10 '19 at 06:58
1 Answers
2
VS code uses monaco editor npm link inside an electron app, U can use this module to build your editor.
Alternative to monaco are, Codemirror website link
These editors will give u intellisense, formatting, highligting out of the box.
However, building them from scratch will be difficult.
If you want to build a simple text editor, have a look at this github repo Pell text editor for source code.
More example of simple text editor

Gautam Naik
- 8,990
- 3
- 27
- 42