Unicode Emoji Wrapper with JavaScript
There are two attributes to create emoji. The first attribute is related to emoji name. This attribute must be filled.
Second attribute is optional. An emoji size default by 15 px. You don't have to init this attribute.
<i data-emoji="grinning" data-emoji-size="48"></i>
For example, you have a rich text editor. You can use all emojis with their shortcode. This required an event like click.
<span>This is an example. :grin:</span>
There are two example to understand emoji.js
The default usage like below.
import Emoji from "./emoji"
const emoji = new Emoji()
emoji.init()
If you want to use with shortcodes you need to use like below. There are two optional arguments.
shortcode argument by default true and shortcodeSize argument by default 16px
import Emoji from "./emoji"
const emoji = new Emoji({
shortcode: true,
shortcodeSize: 16
})
const btn = document.querySelector("#myEmoji")
btn.addEventListener("click", () => {
// let's assume you clicked to `:grin:` to add your favorite editor.
emoji.useShortCode()
})
All emojis coming from emojipedia.
Please contribute to diversity.
Currently, I need to complete :
In order to help to this repository, you need to check the files under the /src/types
folder. Please, respect the format.