From 96ea5764cbe4e6e3869cd0fe6620e5216f94ffc0 Mon Sep 17 00:00:00 2001 From: DominikMeca <92153840+DominikMeca@users.noreply.github.com> Date: Wed, 17 Jan 2024 18:00:27 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20include=20text=20preceeding=20special?= =?UTF-8?q?=20case=20emojis,=20include=20=E2=84=A2=20symbol=20in=20exclude?= =?UTF-8?q?d=20emojisxcluded=20emojis=20(#2502)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Include text preceeding special case emojis, include ™ symbol in excluded emojis * Create sharp-mirrors-taste.md --------- Co-authored-by: Diego Muracciole --- .changeset/sharp-mirrors-taste.md | 5 +++++ packages/layout/src/text/emoji.js | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/sharp-mirrors-taste.md diff --git a/.changeset/sharp-mirrors-taste.md b/.changeset/sharp-mirrors-taste.md new file mode 100644 index 000000000..a0d1f852b --- /dev/null +++ b/.changeset/sharp-mirrors-taste.md @@ -0,0 +1,5 @@ +--- +"@react-pdf/layout": patch +--- + +feat: include text preceeding special case emojis, include ™ symbol in excluded emojis diff --git a/packages/layout/src/text/emoji.js b/packages/layout/src/text/emoji.js index 3f66a7f84..3de5604ea 100644 --- a/packages/layout/src/text/emoji.js +++ b/packages/layout/src/text/emoji.js @@ -67,7 +67,7 @@ export const fetchEmojis = (string, source) => { return promises; }; -const specialCases = ['©️', '®']; // Do not treat these as emojis if emoji not present +const specialCases = ['©️', '®', '™']; // Do not treat these as emojis if emoji not present export const embedEmojis = fragments => { const result = []; @@ -101,7 +101,7 @@ export const embedEmojis = fragments => { }, }); } else if (isSpecialCase) { - result.push({ string: emoji, attributes: fragment.attributes }); + result.push({ string: chunk, attributes: fragment.attributes }); } else { // If no emoji data, we just replace the emoji with a nodef char result.push({