File tree 1 file changed +3
-6
lines changed
app/assets/javascripts/backbone/plugins
1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change 1
1
class Kandan.Plugins.Emoticons
2
2
3
3
@options :
4
- regex : / \( [a-zA-Z ] + \) | (:[a-z ] + :)| (^ | \s )+ ([:|=][\) |\( |P|p] )($ | \s )/ g
4
+ regex : / \( [a-zA-Z ] + \) | (:[\w \-+ ] + :)| (^ | \s )+ ([:|=][\) |\( |P|p] )($ | \s )/ g
5
5
template : _ .template '''
6
6
<img class="emoticon-embed <%= css %>" src="/assets/emoticons/<%= src %>" title="<%= title %>" />
7
7
'''
@@ -910,12 +910,9 @@ class Kandan.Plugins.Emoticons
910
910
matches = message .content .match (@options .regex )
911
911
for match in _ .unique (matches)
912
912
match = match .trim ();
913
- emoticon = @emoticons [match]
913
+ emoticon = @emoticons [match]
914
914
915
915
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))
920
917
921
918
return Kandan .Helpers .Activities .buildFromMessageTemplate (message)
You can’t perform that action at this time.
0 commit comments