mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-18 11:32:24 -05:00
25 lines
594 B
Text
25 lines
594 B
Text
|
import { on, observes } from 'ember-addons/ember-computed-decorators';
|
||
|
import autosize from 'admin/lib/autosize';
|
||
|
|
||
|
export default Ember.TextArea.extend({
|
||
|
@on('didInsertElement')
|
||
|
_startWatching() {
|
||
|
Ember.run.scheduleOnce('afterRender', () => {
|
||
|
this.$().focus();
|
||
|
autosize(this.element);
|
||
|
});
|
||
|
},
|
||
|
|
||
|
@observes('value')
|
||
|
_updateAutosize() {
|
||
|
const evt = document.createEvent('Event');
|
||
|
evt.initEvent('autosize:update', true, false);
|
||
|
this.element.dispatchEvent(evt);
|
||
|
},
|
||
|
|
||
|
@on('willDestroyElement')
|
||
|
_disableAutosize() {
|
||
|
autosize.destroy(this.$());
|
||
|
}
|
||
|
});
|