mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
24 lines
661 B
JavaScript
24 lines
661 B
JavaScript
import Mixin from 'ember-metal/mixin';
|
|
|
|
export default Mixin.create({
|
|
selectOnClick: false,
|
|
stopEnterKeyDownPropagation: false,
|
|
|
|
click(event) {
|
|
if (this.get('selectOnClick')) {
|
|
event.currentTarget.select();
|
|
}
|
|
},
|
|
|
|
keyDown(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;
|
|
}
|
|
}
|
|
});
|