2016-06-30 13:21:47 +03:00
|
|
|
import Mixin from 'ember-metal/mixin';
|
2015-10-28 14:36:45 +03:00
|
|
|
|
|
|
|
export default Mixin.create({
|
2014-04-20 18:48:34 +04:00
|
|
|
selectOnClick: false,
|
2014-08-03 07:17:25 +04:00
|
|
|
stopEnterKeyDownPropagation: false,
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
click(event) {
|
2014-04-20 18:48:34 +04:00
|
|
|
if (this.get('selectOnClick')) {
|
|
|
|
event.currentTarget.select();
|
|
|
|
}
|
|
|
|
},
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
keyDown(event) {
|
2014-08-03 07:17:25 +04:00
|
|
|
// 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-25 01:09:50 +04:00
|
|
|
|
2014-08-03 07:17:25 +04:00
|
|
|
return true;
|
|
|
|
}
|
2014-04-20 18:48:34 +04:00
|
|
|
}
|
|
|
|
});
|