From a9a3d31b3fabe899fab57fdf9a732a691f71026e Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Tue, 5 Jul 2016 10:43:09 +0530 Subject: [PATCH] feat: improve emoji-body detection --- src/HtmlUtils.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/HtmlUtils.js b/src/HtmlUtils.js index bfc7c5bfb8..4c296c95d9 100644 --- a/src/HtmlUtils.js +++ b/src/HtmlUtils.js @@ -217,8 +217,9 @@ module.exports = { } EMOJI_REGEX.lastIndex = 0; - let match = EMOJI_REGEX.exec(body); - let emojiBody = match && match[0] && match[0].length === body.length; + let contentBodyTrimmed = content.body.trim(); + let match = EMOJI_REGEX.exec(contentBodyTrimmed); + let emojiBody = match && match[0] && match[0].length === contentBodyTrimmed.length; let className = classNames('markdown-body', { 'emoji-body': emojiBody,