A Powerful Tree Editing Component
Treed wants to be for tree editing what ace is for text editing. Extensible, customizible, powerful, and just plain easy to use. Perhaps that's a little ambitious, but that's the idea.
I'm a vim user, so there are a lot of vim navigation commands that work out of the box, as well as more normal commands for everyone else.
Action | Bindings |
---|---|
Navigation | arrow keys, hjkl |
Indent/Dedent | tab, shift tab |
Collapse/Expand | alt left/right alt h/l z (toggle) |
Undo/Redo | ctrl z, ctrl shift z, u, R |
Move Node | ctrl alt arrow / hjkl |
Edit mode | return, f2, a, A, i, I |
Normal Mode | escape |
Toggle Done | ctrl return |
New Node | o, O (before) return (in insert mode) |
Cut/Copy/Paste | ctrl x / delete, ctrl c, ctrl v |
There are several more as well.
Treed is constructed using the MVC pattern such that it is simple to, for example, create an entirely different view for the tree.
You can also create your own "Node" class if you wanted to do more than just have a single text input. You could add buttons, more fields, whatever you want.
It works. Unlimited undo.
I'm still tinkering with the interaction on this. Should I let you drop as children of nodes that have no children?
I made this version in a weekend, so there are still some things to do :)
- multi-line select (cut/copy/paste multiple, not necessarily contiguous)
- api docs
- testing (js browser)
I want to implement a view layer similar to each of the following sevices:
- workflowy
- trello
- a whiteboard
- ginko
- mindmap
And hook them all to the same model, allowing you to switch between contexts. And then hook it all up to a database (firebase or hood.ie or pouchdb or leveldb?). I think it will be exactly what I've always wanted; we'll see.
You will need:
npm install
cd demo
webpack --watch
Then open demo/plugins/index.html
for example in your favorite browser, and
enjoy!