Skip to content

Commit

Permalink
FIX: Better boundary checking for emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
eviltrout committed Aug 27, 2014
1 parent aab8eaa commit 965ff51
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/emoji/assets/javascripts/emoji.js.erb
Expand Up @@ -80,6 +80,10 @@
translationColonRegexp.lastIndex = 0;
var m = translationColonRegexp.exec(text);
if (m && m[0] && text.indexOf(m[0]) === 0) {

// Check outer edge
var lastChar = text.charAt(m[0].length);
if (lastChar && (lastChar !== ' ' && lastChar !== "\n")) return;
contents = imageFor(translationsWithColon[m[0]]);
if (contents) {
return [m[0].length, contents];
Expand Down

0 comments on commit 965ff51

Please sign in to comment.