Simplify loading emoji data (#1790)

This commit is contained in:
dan 2023-11-01 17:49:07 +00:00 committed by GitHub
parent 9fb20517ae
commit f9944b55e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 22 deletions

View file

@ -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)
}

View file

@ -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}
/>

File diff suppressed because one or more lines are too long