[Mentions] Fix Bug 43039. Hide menu when type Tab, prevent pressing down arrow when emali list is visible
This commit is contained in:
parent
ab3aad4c50
commit
1cf3c9c060
|
@ -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
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue