summaryrefslogtreecommitdiff
path: root/web-ui/app/js/mail_view/ui/recipients
diff options
context:
space:
mode:
authorPedro Vereza <pdrvereza@gmail.com>2014-10-24 09:57:15 -0200
committerPedro Vereza <pdrvereza@gmail.com>2014-10-24 10:13:07 -0200
commit7bbc79dd46f8b23961d6abc9567dc66365d03398 (patch)
treed30922804f1f682f3de4dd8c857d3d0f55e428d0 /web-ui/app/js/mail_view/ui/recipients
parent7005b03934b2b666b56fb972cfad057a46d2fcbd (diff)
Issue #78 - Tokenize emails on blur
Diffstat (limited to 'web-ui/app/js/mail_view/ui/recipients')
-rw-r--r--web-ui/app/js/mail_view/ui/recipients/recipients_input.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/web-ui/app/js/mail_view/ui/recipients/recipients_input.js b/web-ui/app/js/mail_view/ui/recipients/recipients_input.js
index e39ebf6a..a74e871e 100644
--- a/web-ui/app/js/mail_view/ui/recipients/recipients_input.js
+++ b/web-ui/app/js/mail_view/ui/recipients/recipients_input.js
@@ -102,10 +102,8 @@ define([
}
if (isEnterAddressKey(keyPressed)) {
- if (!_.isEmpty(this.$node.val())) {
- this.recipientSelected(null, { value: this.$node.val() });
- event.preventDefault();
- }
+ this.tokenizeRecipient(event);
+
if((keyPressed !== 9 /* tab */)) {
event.preventDefault();
}
@@ -113,6 +111,15 @@ define([
};
+ this.tokenizeRecipient = function (event) {
+ if (_.isEmpty(this.$node.val())) {
+ return;
+ }
+
+ this.recipientSelected(null, {value: this.$node.val() });
+ event.preventDefault();
+ }
+
this.recipientSelected = function (event, data) {
var value = (data && data.value) || this.$node.val();
@@ -141,11 +148,11 @@ define([
this.trigger(document, toTrigger, { name: this.attr.name });
};
-
this.after('initialize', function () {
self = this;
this.init();
this.on('typeahead:selected typeahead:autocompleted', this.recipientSelected);
+ this.on(this.$node, 'blur', this.tokenizeRecipient);
this.on(this.$node, 'keydown', this.processSpecialKey);
this.on(this.$node, 'keyup', this.warnSendButtonOfInputState);