Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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