Text Editor
This is a sample file to demonstrate the vian editor.
Most of the movement and insert/delete commands are complete,
so vian is completely usable for editing text. A lot of the
vi command line functions are missing, or not provided on
purpose (you'll have to handle :w and such on your own.)
If you take a look at the source code to this web page, you
can see that the html components are just two "pre" tags
in a div. In order to embed vian in your own web page,
you need the two pre tags, but not necessarily the div.
You'll have to fiddle around with webDesk.js or just copy
whatever you need, depending on if you need a draggable
window or not.
You have to give the vian "pre" tag keyboard focus in
order to edit with it, and since pre elements don't fire
keyboard events by default, you have to handle the keyboard
events using the document.onkeypressed and onkeydown events,
and send those to the editorKeyPressed() function. Most of
what you need can be copied from webDesk.js.
Related files in this directory:
index.html - page layout and this text
editor.js - the editor program (majority of stuff is here)
webDesk.js - javascript responsible for drawing
this window and "desktop," and
handling input events
webDesk.css - css to make it all look correct