Just started to play with Ember.js and by reading the code I encounter the following lines:
Em.TextField.extend({
insertNewline: function() {
....
}
});
as far as I understood, insertNewLine is an event on clicking “enter” while inside the field, but looking in the documentation for TextField I failed to find information about this event, and other events of TextField as well.
What events are supported?
Not a noob question at all!
Ember TextField inherits from Ember’s TextSupport. TextSupport is basically a class that can share functionality for text fields (inputs) and text areas.
If you take a look at TextSupport (https://github.com/emberjs/ember.js/blob/master/packages/ember-handlebars/lib/controls/text_support.js) you’ll see a key map at the bottom of the file. This map will be queried on every key up event, trying to match a key to a function. The two default functions are insertNewline (enter) and cancel (esc). You can add as many as you want here.