DEV: Fix `ember/no-incorrect-calls-with-inline-anonymous-functions` (#24010)

This commit is contained in:
Jarek Radosz 2023-10-19 13:47:01 +02:00 committed by GitHub
parent 754d13f5fa
commit b45720b158
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 10 deletions

View File

@ -25,6 +25,10 @@ export default class UserStatusPicker extends Component {
return emojiUnescape(emoji);
}
focusEmojiButton() {
document.querySelector(".btn-emoji")?.focus();
}
@action
blur() {
this.set("isFocused", false);
@ -35,9 +39,7 @@ export default class UserStatusPicker extends Component {
this.set("status.emoji", emoji);
this.set("emojiPickerIsActive", false);
scheduleOnce("afterRender", () => {
document.querySelector(".btn-emoji")?.focus();
});
scheduleOnce("afterRender", this, this.focusEmojiButton);
}
@action

View File

@ -492,7 +492,13 @@ export default class ComposerService extends Service {
@action
async focusComposer(opts = {}) {
await this._openComposerForFocus(opts);
this._focusAndInsertText(opts.insertText);
scheduleOnce(
"afterRender",
this,
this._focusAndInsertText,
opts.insertText
);
}
async _openComposerForFocus(opts) {
@ -525,13 +531,11 @@ export default class ComposerService extends Service {
}
_focusAndInsertText(insertText) {
scheduleOnce("afterRender", () => {
document.querySelector("textarea.d-editor-input")?.focus();
document.querySelector("textarea.d-editor-input")?.focus();
if (insertText) {
this.model.appendText(insertText, null, { new_line: true });
}
});
if (insertText) {
this.model.appendText(insertText, null, { new_line: true });
}
}
@action