Skip to content

Instantly share code, notes, and snippets.

@sebmarkbage
Created August 8, 2010 03:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sebmarkbage/513533 to your computer and use it in GitHub Desktop.
Save sebmarkbage/513533 to your computer and use it in GitHub Desktop.
el.set('contentEditable', true)
.addEvents({
keydown: function(e){ if (e.key == 'enter') e.preventDefault(); },
keypress: function(e){ if (e.event.which == 0 && e.code == 13) e.preventDefault(); },
blur: function(){ var text = this.get('text'); this.set('text', text); }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment