Skip to content

Commit e03e9d9

Browse files
author
Tony Guntharp
committed
Merge pull request #125 from donthorp/issue-119
Fixes issue #119. Emoji with numbers, underscores, dash, and plus no longer ignored.
2 parents bf59ed7 + d6a3291 commit e03e9d9

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

app/assets/javascripts/backbone/plugins/emoticons.js.coffee

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class Kandan.Plugins.Emoticons
22

33
@options:
4-
regex: /\([a-zA-Z]+\)|(:[a-z]+:)|(^|\s)+([:|=][\)|\(|P|p])($|\s)/g
4+
regex: /\([a-zA-Z]+\)|(:[\w\-+]+:)|(^|\s)+([:|=][\)|\(|P|p])($|\s)/g
55
template: _.template '''
66
<img class="emoticon-embed <%= css %>" src="/assets/emoticons/<%= src %>" title="<%= title %>" />
77
'''
@@ -910,12 +910,9 @@ class Kandan.Plugins.Emoticons
910910
matches = message.content.match(@options.regex)
911911
for match in _.unique(matches)
912912
match = match.trim();
913-
emoticon = @emoticons[match]
913+
emoticon = @emoticons[match]
914914

915915
if emoticon
916-
needle = match.replace('(', '\\(').replace(')', '\\)')
917-
search = new RegExp(needle, 'g')
918-
replacement = @options.template(emoticon)
919-
message.content = message.content.replace(search, replacement)
916+
message.content = message.content.replace(match, @options.template(emoticon))
920917

921918
return Kandan.Helpers.Activities.buildFromMessageTemplate(message)

0 commit comments

Comments
 (0)