From de7302c0e93a3225aa3853cbb70fb9fd47385d75 Mon Sep 17 00:00:00 2001 From: Arthur Helfstein Fragoso Date: Wed, 17 Nov 2021 03:20:49 -0300 Subject: [PATCH] autocomplete enterkey lock When pressing enter to selecting an emoji in the autocompletion dropdown, there is a trigger event. And we need to distigish if the enter was pressed to send the message or to seletect the emoji. This simple lock variable should help with that. --- src/function/init.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/function/init.js b/src/function/init.js index b206cde1..a1d0a5f1 100644 --- a/src/function/init.js +++ b/src/function/init.js @@ -42,6 +42,7 @@ function($, emojione, blankImg, slice, css_class, emojioneSupportMode, invisible self.emojiTemplateAlt = self.sprite ? '' : ''; self.emojiBtnTemplate = '' + self.emojiTemplateAlt + ''; self.recentEmojis = options.recentEmojis && supportsLocalStorage(); + self.autocomplete_enter_lock = false; var pickerPosition = options.pickerPosition; self.floatingPicker = pickerPosition === 'top' || pickerPosition === 'bottom'; @@ -560,6 +561,7 @@ function($, emojione, blankImg, slice, css_class, emojioneSupportMode, invisible if (options.shortcuts) { textcompleteOptions.onKeydown = function (e, commands) { if (!e.ctrlKey && e.which == 13) { + self.autocomplete_enter_lock = true; return commands.KEY_ENTER; } };