Last 10 days I’ve been experimenting with FireFox selection API
trying to find out if it’s possible to implement a full-featured
web-based editor. Of course, there are a lot of good ones such as
CodeMirror, CodePress or 9NE. But none of them felt like home.
Must say, my experiment ended successfully and there is a working proof-of-concept script. It’s not cross-browser and only
works with FireFox 3.6(+?). It relies on W3C selection & range API.
I could implement most of desktop IDE features such as:
Smart indentation on newline
Indent/unindent selected code block
IDE-style caret movement on ctrl + [left/right]
IDE-style ctrl + [backspace]
IDE-style tabulation handling
Auto-completion of quotes and brackets
Auto-bypassing of closing quotes and brackets
ctrl + D - duplicates current line
ctrl + Y - removes current line
ctrl + G - goto specified line
ctrl + [up/down] - viewport scrolling
Besides all said, it’s very fast even on a large files (50K+),
has UNDO/REDO functionality (ctrl + Z, ctrl + shift + Z) and
has snippet insertion mode (type ‘class’ and press TAB).
I’ve made even more experiments and found it’s possible to
implement such things as live syntax checking, square selection,
bookmarking and code folding.
I think this script might become a good addition to GII and,
hopefully, in a very short time we’ll be able to develop WEB
projects in a browser.
Again, here is the demo link to play with an editor
[color="#FF0000"]FireFox 3.6 ONLY!!![/color]
P.S. Please let me know what you think! Comments, ideas and
bugs are more than welcome!