FIX: ensures composer is focused after edit (#18999)

- afterRender is not needed as it's already done in the `chat:focus-composer` event
- removes `focusComposer` function which is duplicating logic
This commit is contained in:
Joffrey JAFFEUX 2022-11-14 08:15:20 +01:00 committed by GitHub
parent 1a1d1424ed
commit 27c15bfd53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 16 deletions

View File

@ -246,7 +246,7 @@ export default Component.extend({
this.highlightOrFetchMessage(this.targetMessageId);
}
this.focusComposer();
this._focusComposer();
})
.catch(this._handleErrors)
.finally(() => {
@ -1165,6 +1165,7 @@ export default Component.extend({
}
if (lastUserMessage) {
this.set("editingMessage", lastUserMessage);
this._focusComposer();
}
},
@ -1395,21 +1396,6 @@ export default Component.extend({
return this._fetchAndScrollToLatest();
},
focusComposer() {
if (
this._selfDeleted ||
this.site.mobileView ||
this.chatChannel?.isDraft
) {
return;
}
schedule("afterRender", () => {
document.querySelector(".chat-composer-input")?.focus();
});
},
@afterRender
_focusComposer() {
this.appEvents.trigger("chat:focus-composer");
},