Open sora-tech opened 2 years ago
It looks like this is because web components cannot take functions as attributes, but only strings.
https://stackoverflow.com/questions/50865614/can-i-pass-function-as-attribute-to-web-component
So when passed a function em-emoji
will always actually get null
and this will always be null
:
It seems like a good solution would be to just change getSpritesheetURL
to just spritesheetURL
and have it be a string.
I'm not even sure of the utility of it being a function; you'll always be passing the set
attribute to the em-emoji
component so you know which set you're using and don't really need it when generating the URL?
Also worth noting that this DOES work with the emoji picker that is exported from @emoji-mart/react
since it passes the props down from React.
Another solution could be to also export an Emoji
component from @emoji-mart/react
... at that point the web component isn't fully usable, though 🤔
Following on from https://github.com/missive/emoji-mart/issues/585
When displaying an emoji using
<em-emoji set="twitter" getSpritesheetURL={()=>"sprites.png"} shortcodes=":+1"></em-emoji>
the image is always fetched from the cdn.Expected result is it uses the url provided from the function in the same way the Picker element does.
Actual Result:
Versions: React: 18.1.0 emoji-mart: 5.2.2 @emoji-mart/react: 1.0.1 @emoji-mart/data: 1.0.6