
* feat: use emoji-picker-element, add emoji autocompletions/tooltips * fix: fix lint bug * test: fix emoji in chrome on linux in travis * test: try bionic in travis * chore: try to fix travis * chore: try to fix travis * fix: filter unsupported emoji * chore: try to fix travis * chore: try to fix travis * chore: try to fix travis * chore: try to fix travis * Revert "chore: try to fix travis" This reverts commit 3cd2d94469b2f1a20c847c2a69e088d7c8d1efdd. * fix: fix emoji autosuggest * test: fix test
19 lines
763 B
JavaScript
19 lines
763 B
JavaScript
import * as emojiDatabase from './emojiDatabase'
|
|
|
|
// Add a nice little tooltip to native emoji showing the shortcodes you can type to search for them
|
|
// TODO: titles are not accessible to keyboard users or touch users, and also they don't show up
|
|
// if they're part of a link... should we have another system?
|
|
export async function addEmojiTooltips (domNode) {
|
|
if (!domNode) {
|
|
return
|
|
}
|
|
const emojis = domNode.querySelectorAll('.inline-emoji')
|
|
if (emojis.length) {
|
|
await Promise.all(Array.from(emojis).map(async emoji => {
|
|
const emojiData = await emojiDatabase.findByUnicodeOrName(emoji.textContent)
|
|
if (emojiData && emojiData.shortcodes) {
|
|
emoji.title = emojiData.shortcodes.map(_ => `:${_}:`).join(', ')
|
|
}
|
|
}))
|
|
}
|
|
}
|