}
setupEmojiPicker() {
- emojiPicker.on('emoji', emoji => {
+ emojiPicker.on('emoji', twemojiHtmlStr => {
if (this.state.commentForm.content == null) {
this.state.commentForm.content = '';
}
- let shortName = `:${emojiShortName[emoji]}:`;
+ var el = document.createElement('div');
+ el.innerHTML = twemojiHtmlStr;
+ let nativeUnicode = (el.childNodes[0] as HTMLElement).getAttribute('alt');
+ let shortName = `:${emojiShortName[nativeUnicode]}:`;
this.state.commentForm.content += shortName;
this.setState(this.state);
});
}
setupEmojiPicker() {
- emojiPicker.on('emoji', emoji => {
+ emojiPicker.on('emoji', twemojiHtmlStr => {
if (this.state.postForm.body == null) {
this.state.postForm.body = '';
}
- let shortName = `:${emojiShortName[emoji]}:`;
+ var el = document.createElement('div');
+ el.innerHTML = twemojiHtmlStr;
+ let nativeUnicode = (el.childNodes[0] as HTMLElement).getAttribute('alt');
+ let shortName = `:${emojiShortName[nativeUnicode]}:`;
this.state.postForm.body += shortName;
this.setState(this.state);
});
export const emojiPicker = new EmojiButton({
// Use the emojiShortName from native
- // style: 'twemoji',
+ style: 'twemoji',
theme: 'dark',
position: 'auto-start',
// TODO i18n