Autocomplete: store last searched-for string into separate variable for later consumption

Reason:
Autocompleting person contacts works as expected - ksearch_value is available and passed to triggerEvent.
But with group autocomplete, ksearch_value is reset (to null) and triggerEvent call lacks necessary data.
pull/5203/head
Bostjan Skufca 9 years ago
parent f919e8ffa6
commit 12756e2297

@ -5182,7 +5182,8 @@ function rcube_webmail()
this.set_caret_pos(this.ksearch_input, p + insert.length);
if (trigger) {
this.triggerEvent('autocomplete_insert', { field:this.ksearch_input, insert:insert, data:this.env.contacts[id], search:this.ksearch_value, result_type:'person' });
this.triggerEvent('autocomplete_insert', { field:this.ksearch_input, insert:insert, data:this.env.contacts[id], search:this.ksearch_value_last, result_type:'person' });
this.ksearch_value_last = null;
this.compose_type_activity++;
}
};
@ -5191,7 +5192,8 @@ function rcube_webmail()
{
if (this.group2expand[id]) {
this.group2expand[id].input.value = this.group2expand[id].input.value.replace(this.group2expand[id].name, recipients);
this.triggerEvent('autocomplete_insert', { field:this.group2expand[id].input, insert:recipients, data:this.group2expand[id], search:this.ksearch_value, result_type:'group' });
this.triggerEvent('autocomplete_insert', { field:this.group2expand[id].input, insert:recipients, data:this.group2expand[id], search:this.ksearch_value_last, result_type:'group' });
this.ksearch_value_last = null;
this.group2expand[id] = null;
this.compose_type_activity++;
}
@ -5234,6 +5236,7 @@ function rcube_webmail()
var old_value = this.ksearch_value;
this.ksearch_value = q;
this.ksearch_value_last = q; // Group expansion clears ksearch_value before calling autocomplete_insert trigger, therefore store it in separate variable for later consumption.
// ...string is empty
if (!q.length)

Loading…
Cancel
Save