Skip to content

Instantly share code, notes, and snippets.

@theworkerant
Last active August 28, 2019 21:04
Show Gist options
  • Save theworkerant/f0133c69ee11d07e4808d56739cb9aad to your computer and use it in GitHub Desktop.
Save theworkerant/f0133c69ee11d07e4808d56739cb9aad to your computer and use it in GitHub Desktop.
Emojify LiveView message
import EmojiConvertor from "emoji-js"
let emoji = new EmojiConvertor
// Emojify on mount hook
let messageHTML = this.el.getElementsByTagName("p")[0]
if (messageHTML) {
messageHTML.innerHTML = emoji.replace_colons(messageHTML.innerHTML)
}
npm install emoji-js --save --prefix assets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment