From c2eceaa50de002f69d6bba513f5fd7e0b6db3460 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Tue, 1 Sep 2015 14:26:23 +0800 Subject: [PATCH] FIX: Allow user to quote Emojis. --- app/assets/javascripts/discourse/lib/utilities.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/lib/utilities.js b/app/assets/javascripts/discourse/lib/utilities.js index ac55bdaf4..05ed05caf 100644 --- a/app/assets/javascripts/discourse/lib/utilities.js +++ b/app/assets/javascripts/discourse/lib/utilities.js @@ -97,7 +97,10 @@ Discourse.Utilities = { // Strip out any .click elements from the HTML before converting it to text var div = document.createElement('div'); div.innerHTML = html; - $('.clicks', $(div)).remove(); + var $div = $(div); + // Find all emojis and replace with its title attribute. + $div.find('img.emoji').replaceWith(function() { return this.title }); + $('.clicks', $div).remove(); var text = div.textContent || div.innerText || ""; return String(text).trim();