Skip to content

Instantly share code, notes, and snippets.

@collin
Created September 25, 2008 16:05
Show Gist options
  • Save collin/12845 to your computer and use it in GitHub Desktop.
Save collin/12845 to your computer and use it in GitHub Desktop.
_(textarea)
.keybind('ctrl+left', function() {
_(this).parent_node().parent_node().edit_in_place();
})
.keybind('ctrl+shift+left', function() {
var node = _(this).parent_node();
node.parent_node().before(node);
textarea.focus();
})
.keybind('ctrl+right', function() {
_(this).parent_node().child_list().find('.tree_node:first').edit_in_place();
})
.keybind('ctrl+shift+right', function() {
var node = _(this).parent_node();
node.next().child_list().prepend(node);
textarea.focus();
})
.keybind('ctrl+up', function() {
_(this).parent_node().prev().edit_in_place();
})
.keybind('ctrl+shift+up', function() {
var node = _(this).parent_node();
node.prev().before(node);
textarea.focus();
})
.keybind('ctrl+down', function() {
_(this).parent_node().next().edit_in_place();
})
.keybind('ctrl+shift+down', function() {
var node = _(this).parent_node();
node.next().after(node);
textarea.focus();
})
.keybind('enter', function() {
var node = _(this).parent_node()
,_new = node.create_node();
node.after(_new);
_new.edit_in_place();
})
.keybind('shift+enter', function() {
var node = _(this).parent_node()
,_new = node.create_node();
node.child_list().prepend(_new);
_new.edit_in_place();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment