Skip to content

Instantly share code, notes, and snippets.

@poteto
Last active August 29, 2015 14:11
Show Gist options
  • Save poteto/0db533ab0008562c92d2 to your computer and use it in GitHub Desktop.
Save poteto/0db533ab0008562c92d2 to your computer and use it in GitHub Desktop.
{{textarea modifiedSubmit="someControllerAction" value=someText}}
export default Ember.TextArea.reopen({
keyDown: function(event) {
if (this._isValidCombination(event)) {
this.sendAction('modifiedSubmit');
}
},
_hasCorrectModifier: function(event) {
return event.ctrlKey || event.metaKey;
},
_isCorrectKeyCode: function(keyCode) {
return keyCode === 13;
},
_isValidCombination: function(event) {
return this._hasCorrectModifier(event) && this._isCorrectKeyCode(event.keyCode);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment