2014-09-19 03:42:07 +04:00
|
|
|
var BlurField = Ember.Mixin.create({
|
2014-04-20 18:48:34 +04:00
|
|
|
selectOnClick: false,
|
2014-08-03 07:17:25 +04:00
|
|
|
stopEnterKeyDownPropagation: false,
|
2014-04-20 18:48:34 +04:00
|
|
|
click: function (event) {
|
|
|
|
if (this.get('selectOnClick')) {
|
|
|
|
event.currentTarget.select();
|
|
|
|
}
|
|
|
|
},
|
2014-08-03 07: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 18:48:34 +04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-09-19 03:42:07 +04:00
|
|
|
export default BlurField;
|