fix focus after attempting to onebox

This commit is contained in:
Neil Lalonde 2016-12-08 16:26:59 -05:00
parent fbd8e6ed4a
commit 03ec8f8089
1 changed files with 10 additions and 4 deletions

View File

@ -66,10 +66,12 @@ export default Ember.Component.extend({
this._updatePost(lookupCache(this.get('composer.title')));
}).finally(() => {
this.set('composer.loading', false);
Ember.run.schedule('afterRender', () => { this.$('input').putCursorAtEnd(); });
});
} else {
this._updatePost(loadOnebox);
this.set('composer.loading', false);
Ember.run.schedule('afterRender', () => { this.$('input').putCursorAtEnd(); });
}
}
},
@ -85,16 +87,20 @@ export default Ember.Component.extend({
this.set('composer.reply', this.get('composer.title'));
if (header.length > 0 && header.text().length > 0) {
this.set('composer.title', header.text().trim());
this.changeTitle(header.text());
} else {
const filename = (this.get('composer.featuredLink')||"").split("/").pop();
if (filename && filename.length > 0) {
this.set('composer.title', filename.trim());
}
this.changeTitle(filename);
}
}
},
changeTitle(val) {
if (val && val.length > 0) {
this.set('composer.title', val.trim());
}
},
@computed('composer.title')
isAbsoluteUrl() {
return this.get('composer.titleLength') > 0 && /^(https?:)?\/\/[\w\.\-]+/i.test(this.get('composer.title'));