Skip to content

Commit

Permalink
Simplify loading emoji data (#1790)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored Nov 1, 2023
1 parent 9fb2051 commit f9944b5
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 22 deletions.
9 changes: 0 additions & 9 deletions src/platform/polyfills.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,3 @@ findLast.shim()

// @ts-ignore whatever typescript wants to complain about here, I dont care about -prf
window.setImmediate = (cb: () => void) => setTimeout(cb, 0)

// @ts-ignore not on the TS signature due to bad support -prf
if (!globalThis.Intl?.Segmenter) {
// loading emoji mart data
// TODO: This condition doesn't make sense; emojimart has nothing to do with Intl.
const emojiMartScript = document.createElement('script')
emojiMartScript.setAttribute('src', '/static/js/emoji-mart-data.js')
document.head.appendChild(emojiMartScript)
}
5 changes: 3 additions & 2 deletions src/view/com/composer/text-input/web/EmojiPicker.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ export function EmojiPicker({close}: {close: () => void}) {
},
]}>
<Picker
// @ts-ignore we set emojiMartData in `emoji-mart-data.js` file
data={window.emojiMartData}
data={async () => {
return (await import('./EmojiPickerData.json')).default
}}
onEmojiSelect={onInsert}
autoFocus={false}
/>
Expand Down
File renamed without changes.
11 changes: 0 additions & 11 deletions web/static/js/emoji-mart-data.js

This file was deleted.

0 comments on commit f9944b5

Please sign in to comment.