From a87ae200557312bb90eade8f1aeefd7b4b2f9524 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Fri, 13 Feb 2015 14:56:34 +0300 Subject: [PATCH] Fixed enter Closes #691 --- app/js/message_composer.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/js/message_composer.js b/app/js/message_composer.js index ff7ec906..9afa2252 100644 --- a/app/js/message_composer.js +++ b/app/js/message_composer.js @@ -501,6 +501,7 @@ MessageComposer.prototype.onKeyEvent = function (e) { } if (e.type == 'keydown') { + var checkSubmit = !this.autocompleteShown; if (this.autocompleteShown) { if (e.keyCode == 38 || e.keyCode == 40) { // UP / DOWN var next = e.keyCode == 40; @@ -524,18 +525,19 @@ MessageComposer.prototype.onKeyEvent = function (e) { } if (e.keyCode == 13) { // ENTER - var currentSelected = $(this.autoCompleteEl).find('.composer_emoji_option_active') || - $(this.autoCompleteEl).childNodes[0].find('a'); + var currentSelected = $(this.autoCompleteEl).find('.composer_emoji_option_active')/* || + $(this.autoCompleteEl).childNodes[0].find('a')*/; var code = currentSelected.attr('data-code'); if (code) { this.onEmojiSelected(code, true); EmojiHelper.pushPopularEmoji(code); + return cancelEvent(e); } - return cancelEvent(e); + checkSubmit = true; } } - else if (e.keyCode == 13) { + if (checkSubmit && e.keyCode == 13) { var submit = false; var sendOnEnter = true; if (this.getSendOnEnter && !this.getSendOnEnter()) {