2015-02-12 21:22:32 -07:00
|
|
|
import Ember from 'ember';
|
2015-08-19 12:55:40 +01:00
|
|
|
|
|
|
|
export default Ember.Mixin.create({
|
2014-04-20 08:48:34 -06:00
|
|
|
selectOnClick: false,
|
2014-08-02 23:17:25 -04:00
|
|
|
stopEnterKeyDownPropagation: false,
|
2014-10-24 21:09:50 +00:00
|
|
|
|
2014-04-20 08:48:34 -06:00
|
|
|
click: function (event) {
|
|
|
|
if (this.get('selectOnClick')) {
|
|
|
|
event.currentTarget.select();
|
|
|
|
}
|
|
|
|
},
|
2014-10-24 21:09:50 +00:00
|
|
|
|
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();
|
2014-10-24 21:09:50 +00:00
|
|
|
|
2014-08-02 23:17:25 -04:00
|
|
|
return true;
|
|
|
|
}
|
2014-04-20 08:48:34 -06:00
|
|
|
}
|
|
|
|
});
|