2014-06-08 14:48:14 -06:00
|
|
|
var BlurInput = Ember.TextField.extend({
|
2014-04-20 08:48:34 -06:00
|
|
|
selectOnClick: false,
|
2014-08-02 23:17:25 -04:00
|
|
|
stopEnterKeyDownPropagation: false,
|
2014-04-20 08:48:34 -06:00
|
|
|
click: function (event) {
|
|
|
|
if (this.get('selectOnClick')) {
|
|
|
|
event.currentTarget.select();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
focusOut: function () {
|
|
|
|
this.sendAction('action', this.get('value'));
|
2014-08-02 23:17:25 -04:00
|
|
|
},
|
|
|
|
keyDown: function (event) {
|
|
|
|
// stop event propagation when pressing "enter"
|
|
|
|
// most useful in the case when undesired (global) keyboard shortcuts are getting triggered while interacting
|
|
|
|
// with this particular input element.
|
|
|
|
if (this.get('stopEnterKeyDownPropagation') && event.keyCode === 13) {
|
|
|
|
event.stopPropagation();
|
|
|
|
return true;
|
|
|
|
}
|
2014-04-20 08:48:34 -06:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-06-08 14:48:14 -06:00
|
|
|
export default BlurInput;
|