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({