Simplify closing emoji panel on escape key down

This commit is contained in:
Daniel Gasienica 2018-05-08 17:30:11 -04:00
parent 48708d5738
commit e723484498

View file

@ -223,7 +223,7 @@
},
events: {
'keydown': 'escapeEmojiPanel',
keydown: 'onKeyDown',
'submit .send': 'checkUnverifiedSendMessage',
'input .send-message': 'updateMessageFieldSize',
'keydown .send-message': 'updateMessageFieldSize',
@ -1202,12 +1202,12 @@
this.closeEmojiPanel();
}
},
escapeEmojiPanel(e){
// Close emoji panel on escape key press
const keyCode = e.keyCode || e.which;
if (keyCode == 27 && this.emojiPanel != null) {
this.closeEmojiPanel();
onKeyDown(event) {
if (event.key !== 'Escape') {
return;
}
this.closeEmojiPanel();
},
openEmojiPanel() {
this.$emojiPanelContainer.outerHeight(200);
@ -1217,6 +1217,10 @@
this.updateMessageFieldSize({});
},
closeEmojiPanel() {
if (this.emojiPanel === null) {
return;
}
this.$emojiPanelContainer.empty().outerHeight(0);
this.emojiPanel = null;
this.updateMessageFieldSize({});