mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-15 23:00:57 +00:00
Fix autocomplete bug
This commit is contained in:
@@ -104,8 +104,10 @@ function addAtAutocomplete(ele_id, container_id, data) {
|
|||||||
source: function(request, response) {
|
source: function(request, response) {
|
||||||
var lastTerm = extractLast(request.term);
|
var lastTerm = extractLast(request.term);
|
||||||
var lastIndex = lastTerm.lastIndexOf('@');
|
var lastIndex = lastTerm.lastIndexOf('@');
|
||||||
if (lastIndex >= 0) {
|
if (lastIndex == 0) {
|
||||||
response($.ui.autocomplete.filter(data, lastTerm.substring(lastIndex+1)));
|
response($.ui.autocomplete.filter(data, lastTerm.substring(lastIndex+1)));
|
||||||
|
} else {
|
||||||
|
response();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
focus: function() {
|
focus: function() {
|
||||||
@@ -113,8 +115,8 @@ function addAtAutocomplete(ele_id, container_id, data) {
|
|||||||
},
|
},
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
var terms = split(this.value);
|
var terms = split(this.value);
|
||||||
var popTerm = terms.pop();
|
terms.pop();
|
||||||
terms.push(popTerm.concat(ui.item.value));
|
terms.push('@'.concat(ui.item.value));
|
||||||
terms.push("");
|
terms.push("");
|
||||||
this.value = terms.join(" ");
|
this.value = terms.join(" ");
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user