Ghost/ghost/admin/components/gh-trim-focus-input.js
2014-08-08 11:37:24 -04:00

18 lines
350 B
JavaScript

var TrimFocusInput = Ember.TextField.extend({
focus: true,
setFocus: function () {
if (this.focus) {
this.$().val(this.$().val()).focus();
}
}.on('didInsertElement'),
focusOut: function () {
var text = this.$().val();
this.$().val(text.trim());
}
});
export default TrimFocusInput;