mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
8aef67ef52
fixes #3516 - new behavior is disabled by default - added new stopEnterKeyDownPropagation property enable new behavior
24 lines
767 B
JavaScript
24 lines
767 B
JavaScript
var BlurInput = Ember.TextField.extend({
|
|
selectOnClick: false,
|
|
stopEnterKeyDownPropagation: false,
|
|
click: function (event) {
|
|
if (this.get('selectOnClick')) {
|
|
event.currentTarget.select();
|
|
}
|
|
},
|
|
focusOut: function () {
|
|
this.sendAction('action', this.get('value'));
|
|
},
|
|
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;
|
|
}
|
|
}
|
|
});
|
|
|
|
export default BlurInput;
|