Fix adding groups to the recipient input

pull/5742/merge
Aleksander Machniak 7 years ago
parent a1ba8773d7
commit 05a67898eb

@ -2359,7 +2359,7 @@ function rcube_elastic_ui()
var area, input, ac_props, var area, input, ac_props,
apply_func = function() { apply_func = function() {
// update the original input // update the original input
$(obj).val(area.text()); $(obj).val(area.text() + input.val());
}, },
focus_func = function() { focus_func = function() {
area.addClass('focus'); area.addClass('focus');
@ -2388,15 +2388,16 @@ function rcube_elastic_ui()
}, },
update_func = function() { update_func = function() {
var text = input.val().replace(/[,;\s]+$/, ''), var text = input.val().replace(/[,;\s]+$/, ''),
recipients = recipient_input_parser(text); result = recipient_input_parser(text);
$.each(recipients, function() { $.each(result.recipients, function() {
insert_recipient(this.name, this.email); insert_recipient(this.name, this.email);
}); });
if (recipients.length) { input.val(result.text);
input.val('');
apply_func(); apply_func();
if (result.recipients.length) {
return true; return true;
} }
}, },
@ -2488,10 +2489,14 @@ function rcube_elastic_ui()
email: email.replace(/(^<|>$)/g, ''), email: email.replace(/(^<|>$)/g, ''),
text: this text: this
}); });
text = text.replace(this, '');
} }
}); });
return recipients; text = text.replace(/[,;]+/, ',').replace(/^[,;]/, '');
return {recipients: recipients, text: text};
}; };
/** /**

Loading…
Cancel
Save