DEV: Fix linting issue with emoji keydown event (#15352)

This commit is contained in:
Penar Musaraj 2021-12-17 12:29:52 -05:00 committed by GitHub
parent 4ee5d52ac9
commit 62d1114bad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -89,6 +89,8 @@ export default Component.extend({
return; return;
} }
emojiPicker.addEventListener("keydown", this._keyDown);
const textareaWrapper = document.querySelector( const textareaWrapper = document.querySelector(
".d-editor-textarea-wrapper" ".d-editor-textarea-wrapper"
); );
@ -137,6 +139,9 @@ export default Component.extend({
@action @action
onClose() { onClose() {
document.removeEventListener("click", this.handleOutsideClick); document.removeEventListener("click", this.handleOutsideClick);
document
.querySelector(".emoji-picker")
?.removeEventListener("keydown", this._keyDown);
this.onEmojiPickerClose && this.onEmojiPickerClose(); this.onEmojiPickerClose && this.onEmojiPickerClose();
}, },
@ -215,8 +220,8 @@ export default Component.extend({
section && section.scrollIntoView(); section && section.scrollIntoView();
}, },
@action @bind
keydown(event) { _keyDown(event) {
if (event.code === "Escape") { if (event.code === "Escape") {
this.onClose(); this.onClose();
return false; return false;

View File

@ -1,5 +1,5 @@
{{#if isActive}} {{#if isActive}}
<div {{on "keydown" (action "keydown")}} class="emoji-picker {{if @isActive "opened"}}"> <div class="emoji-picker {{if @isActive "opened"}}">
<div class="emoji-picker-category-buttons"> <div class="emoji-picker-category-buttons">
{{#if recentEmojis.length}} {{#if recentEmojis.length}}
<button type="button" data-section="recent" {{action "onCategorySelection" "recent"}} class="btn btn-default category-button emoji"> <button type="button" data-section="recent" {{action "onCategorySelection" "recent"}} class="btn btn-default category-button emoji">