A platform for community discussion. Free, open, simple.
FIX: Safari issue with some emojis (#6456)
Penar Musaraj26956bbe1aea
diff --git a/lib/pretty_text/shims.js b/lib/pretty_text/shims.jsindex 9631d260f8a..680177914c9 100644--- a/lib/pretty_text/shims.js+++ b/lib/pretty_text/shims.js@@ -20,6 +20,11 @@ __setUnicode = function(replacements) {}text = text.replace(m[0], replacement);}++ // fixes Safari VARIATION SELECTOR-16 issue with some emojis+ // https://meta.discourse.org/t/emojis-selected-on-ios-displaying-additional-rectangles/86132+ text = text.replace(/\ufe0f/g, '');+return text;};};diff --git a/spec/components/pretty_text_spec.rb b/spec/components/pretty_text_spec.rbindex d115a69bfff..dd68a554fca 100644--- a/spec/components/pretty_text_spec.rb+++ b/spec/components/pretty_text_spec.rb@@ -797,6 +797,10 @@ describe PrettyText doexpect(PrettyText.cook("hello π©πΎβπ")).to eq("<p>hello <img src=\"/images/emoji/twitter/woman_student/5.png?v=#{Emoji::EMOJI_VERSION}\" title=\":woman_student:t5:\" class=\"emoji\" alt=\":woman_student:t5:\"></p>")expect(PrettyText.cook("hello π€·ββοΈ")).to eq("<p>hello <img src=\"/images/emoji/twitter/woman_shrugging.png?v=#{Emoji::EMOJI_VERSION}\" title=\":woman_shrugging:\" class=\"emoji\" alt=\":woman_shrugging:\"></p>")end++ it "correctly strips VARIATION SELECTOR-16 character (ufe0f) from some emojis" do+ expect(PrettyText.cook("β€οΈπ£")).to match(/<img src[^>]+bomb[^>]+>/)+ endenddescribe "custom emoji" do