A Really Basic TextArea Editor

A Really Basic TextArea Editor

Mon Jan 31 12:20:37 -0800 2011

I’m working on creating a CMS (You’ll hear more soon enough), and I need a really basic textarea editor. The only things I need from the editor are:

  • Tab gives several soft-spaces instead of tabbing to the next input
  • Enter maintains your current level of indentation
  • Backspace when you’re at the whitespace at the beginning of a line removes a number of spaces equal to your soft-tab width
  • Command+left or home goes to the start of the text on the current line, rather than the beginning of the whitespace.

It doesn’t support any kind of WYSIWYG or syntax highlighting. It’s just a very basic code editor that doesn’t make any assumptions about the kind of code you’re writing. Give it a shot here:

And here’s the source code:

blog comments powered by Disqus