[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.val($this.val().substring(0, start) + '\t' + $this.val().substring(end));
|
||||||
this.selectionStart = this.selectionEnd = start + 1;
|
this.selectionStart = this.selectionEnd = start + 1;
|
||||||
|
|
||||||
event.stopImmediatePropagation();
|
// event.stopImmediatePropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -954,28 +954,30 @@ define([
|
||||||
|
|
||||||
if (this.canRequestUsers) {
|
if (this.canRequestUsers) {
|
||||||
textBox && textBox.keydown(function (event) {
|
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.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) {
|
event.keyCode == Common.UI.Keys.LEFT || event.keyCode == Common.UI.Keys.UP) {
|
||||||
// hide email menu
|
// hide email menu
|
||||||
me.onEmailListMenu();
|
me.onEmailListMenu();
|
||||||
} else if (event.keyCode == Common.UI.Keys.DOWN) {
|
} else if (event.keyCode == Common.UI.Keys.DOWN) {
|
||||||
if (me.emailMenu && me.emailMenu.rendered && me.emailMenu.isVisible())
|
if (me.emailMenu && me.emailMenu.rendered && me.emailMenu.isVisible()) {
|
||||||
_.delay(function() {
|
_.delay(function () {
|
||||||
var selected = me.emailMenu.cmpEl.find('li:not(.divider):first');
|
var selected = me.emailMenu.cmpEl.find('li:not(.divider):first');
|
||||||
selected = selected.find('a');
|
selected = selected.find('a');
|
||||||
selected.focus();
|
selected.focus();
|
||||||
}, 10);
|
}, 10);
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
me.e = event;
|
me.e = event;
|
||||||
});
|
});
|
||||||
textBox && textBox.on('input', function (event) {
|
textBox && textBox.on('input', function (event) {
|
||||||
var $this = $(this),
|
var $this = $(this),
|
||||||
start = this.selectionStart,
|
start = this.selectionStart,
|
||||||
val = $this.val().replace(/[\n]$/, ""),
|
val = $this.val(),
|
||||||
left = 0, right = val.length-1;
|
left = 0, right = val.length-1;
|
||||||
for (var i=start-1; i>=0; i--) {
|
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;
|
left = i+1; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -989,7 +991,8 @@ define([
|
||||||
if (res && res.length>1) {
|
if (res && res.length>1) {
|
||||||
str = res[1]; // send to show email menu
|
str = res[1]; // send to show email menu
|
||||||
me.onEmailListMenu(str, left, right);
|
me.onEmailListMenu(str, left, right);
|
||||||
}
|
} else
|
||||||
|
me.onEmailListMenu(); // hide email menu
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue