Fix emoticons: Was not upgraded to use promises

This commit is contained in:
Robin Ward 2013-04-09 10:59:27 -04:00
parent fa27476267
commit e783891f31
1 changed files with 11 additions and 8 deletions

View File

@ -14,10 +14,10 @@
}
this.textResult = text.replace(/\:([a-z\_\+\-0-9]+)\:/g, function (m1, m2) {
return (emoji.indexOf(m2) !== -1) ?
'<img alt="' + m2 + '" title=":' + m2 + ':" src="/assets/emoji/' + m2 + '.png" ' + style + ' class="emoji"/>' :
m1;
});
return (emoji.indexOf(m2) !== -1) ?
'<img alt="' + m2 + '" title=":' + m2 + ':" src="/assets/emoji/' + m2 + '.png" ' + style + ' class="emoji"/>' :
m1;
});
});
@ -40,13 +40,14 @@
template: template,
key: ":",
transformComplete: function(v){ return v + ":"; },
dataSource: function(term, callback){
dataSource: function(term){
term = term.toLowerCase();
if (term == "") {
callback(["smile", "smiley", "wink", "sunny", "blush"]);
return
return Ember.Deferred.promise(function (promise) {
promise.resolve(["smile", "smiley", "wink", "sunny", "blush"]);
});
}
var options = []
@ -67,7 +68,9 @@
}
}
callback(options)
return Ember.Deferred.promise(function (promise) {
promise.resolve(options);
});
}
});
});