mirror of
https://github.com/flarum/framework.git
synced 2025-01-10 13:03:43 +08:00
19 lines
384 B
JavaScript
19 lines
384 B
JavaScript
import Ember from 'ember';
|
|
|
|
export default Ember.TextField.extend({
|
|
didInsertElement: function() {
|
|
var component = this;
|
|
this.$().on('input', function() {
|
|
var empty = !$(this).val();
|
|
if (empty) {
|
|
$(this).val(component.get('placeholder'));
|
|
}
|
|
$(this).css('width', 0);
|
|
$(this).width($(this)[0].scrollWidth);
|
|
if (empty) {
|
|
$(this).val('');
|
|
}
|
|
});
|
|
}
|
|
});
|