Giter Site home page Giter Site logo

Comments (6)

EtienneLem avatar EtienneLem commented on July 21, 2024

There isn’t a direct way to get it, since it’s always dynamic and depends on a few props (emoji.js#L126), but tenically one could:

Emoji.defaultProps.backgroundImageFn(
  Emoji.defaultProps.set, // apple
  Emoji.defaultProps.sheetSize // 64
)

That function returns the sheet URL used. EmojiMart uses spritesheets provided by https://github.com/iamcal/emoji-data, so all emojis have the same URL. Is that what you wanted, or were you looking for a distinct URL per emoji to use in a <img> element?

from emoji-mart.

t1mmen avatar t1mmen commented on July 21, 2024

Hi @EtienneLem,

Thanks for the super fast response!

I'm specifically looking for the unique URL's/filenames for the Twemoji set, as the backend I'm integrating with requires the direct URL to the emoji.

Looking at emoji-data's example in https://github.com/iamcal/emoji-data/blob/master/README.md, the image value is what I'm looking for (since that appears to reference https://github.com/twitter/twemoji/blob/gh-pages/36x36/261d.png)

I suppose I could find the right image via emoji-data, but it would be helpful to avoid another direct dependency.

Thanks again for your time, and hard work!

from emoji-mart.

EtienneLem avatar EtienneLem commented on July 21, 2024

I see. What EmojiMart could do is at least return the unified value in the click callback, so you could then easily construct a URL that you could store on your backend.

I would suggest using https://rawgit.com (unless you’re hosting all emoji images yourself?). For example: https://cdn.rawgit.com/iamcal/emoji-data/v2.4.4/img-twitter-64/261d.png or https://cdn.rawgit.com/twitter/twemoji/gh-pages/36x36/261d.png

261d would be the new value added in the onClick callback and it would be up to you to “figure out” an absolute URL that points to that emoji (cdn, self-hosted, etc.)

Would that work for you?

from emoji-mart.

t1mmen avatar t1mmen commented on July 21, 2024

261d would be the new value added in the onClick callback and it would be up to you to “figure out” an absolute URL that points to that emoji (cdn, self-hosted, etc.)

Yes, that would be perfect! 😍

from emoji-mart.

EtienneLem avatar EtienneLem commented on July 21, 2024

There you go! Available in v0.4.4.

As a FYI:
Some emojis (i.e. the :point-up:), will have -fe0f at the end of the unified value, but the images in both emoji-data and Twemoji don’t. That’s because these emojis sort of exist under 2 different forms:

screen shot 2017-03-17 at 9 02 14 am

EmojiMart will return 261d-fe0f because that’s the codePoint needed to reconstruct the native emoji. However in your case, I think it’d be safe to always unified.replace(/-fe0f$/, '') before storing in your backend.

from emoji-mart.

t1mmen avatar t1mmen commented on July 21, 2024

Thank you very much, @EtienneLem :)

from emoji-mart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.