diff --git a/apps/common/main/lib/view/ReviewPopover.js b/apps/common/main/lib/view/ReviewPopover.js index c2f1a922d..a96e9ace6 100644 --- a/apps/common/main/lib/view/ReviewPopover.js +++ b/apps/common/main/lib/view/ReviewPopover.js @@ -945,7 +945,7 @@ define([ $this.val($this.val().substring(0, start) + '\t' + $this.val().substring(end)); this.selectionStart = this.selectionEnd = start + 1; - event.stopImmediatePropagation(); + // event.stopImmediatePropagation(); event.preventDefault(); } @@ -954,28 +954,30 @@ define([ if (this.canRequestUsers) { textBox && textBox.keydown(function (event) { - if ( event.keyCode == Common.UI.Keys.SPACE || + if ( event.keyCode == Common.UI.Keys.SPACE || event.keyCode === Common.UI.Keys.TAB || event.keyCode == Common.UI.Keys.HOME || event.keyCode == Common.UI.Keys.END || event.keyCode == Common.UI.Keys.RIGHT || event.keyCode == Common.UI.Keys.LEFT || event.keyCode == Common.UI.Keys.UP) { // hide email menu me.onEmailListMenu(); } else if (event.keyCode == Common.UI.Keys.DOWN) { - if (me.emailMenu && me.emailMenu.rendered && me.emailMenu.isVisible()) - _.delay(function() { + if (me.emailMenu && me.emailMenu.rendered && me.emailMenu.isVisible()) { + _.delay(function () { var selected = me.emailMenu.cmpEl.find('li:not(.divider):first'); selected = selected.find('a'); selected.focus(); }, 10); + event.preventDefault(); + } } me.e = event; }); textBox && textBox.on('input', function (event) { var $this = $(this), start = this.selectionStart, - val = $this.val().replace(/[\n]$/, ""), + val = $this.val(), left = 0, right = val.length-1; for (var i=start-1; i>=0; i--) { - if (val.charCodeAt(i) == 32 /*space*/ || val.charCodeAt(i) == 13 || val.charCodeAt(i) == 10 || val.charCodeAt(i) == 9) { + if (val.charCodeAt(i) == 32 /*space*/ || val.charCodeAt(i) == 13 /*enter*/ || val.charCodeAt(i) == 10 /*new line*/ || val.charCodeAt(i) == 9 /*tab*/) { left = i+1; break; } } @@ -989,7 +991,8 @@ define([ if (res && res.length>1) { str = res[1]; // send to show email menu me.onEmailListMenu(str, left, right); - } + } else + me.onEmailListMenu(); // hide email menu }); } },