FIX: Allow user to quote Emojis.

This commit is contained in:
Guo Xiang Tan 2015-09-01 14:26:23 +08:00
parent 9909c715dc
commit c2eceaa50d
1 changed files with 4 additions and 1 deletions

View File

@ -97,7 +97,10 @@ Discourse.Utilities = {
// Strip out any .click elements from the HTML before converting it to text // Strip out any .click elements from the HTML before converting it to text
var div = document.createElement('div'); var div = document.createElement('div');
div.innerHTML = html; 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 || ""; var text = div.textContent || div.innerText || "";
return String(text).trim(); return String(text).trim();