Skip to content

Commit

Permalink
feat: include text preceeding special case emojis, include ™ symbol i…
Browse files Browse the repository at this point in the history
…n excluded emojisxcluded emojis (#2502)

* Include text preceeding special case emojis, include ™ symbol in excluded emojis

* Create sharp-mirrors-taste.md

---------

Co-authored-by: Diego Muracciole <[email protected]>
  • Loading branch information
DominikMeca and diegomura authored Jan 17, 2024
1 parent 6bfe7e8 commit 96ea576
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/sharp-mirrors-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@react-pdf/layout": patch
---

feat: include text preceeding special case emojis, include ™ symbol in excluded emojis
4 changes: 2 additions & 2 deletions packages/layout/src/text/emoji.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit 96ea576

Please sign in to comment.