2019-03-15 12:44:49 +08:00
|
|
|
import {
|
|
|
|
aliases,
|
2020-12-02 02:31:26 +08:00
|
|
|
emojis,
|
2019-03-21 16:11:33 +08:00
|
|
|
replacements,
|
2019-03-15 12:44:49 +08:00
|
|
|
searchAliases,
|
2019-03-21 16:11:33 +08:00
|
|
|
tonableEmojis,
|
|
|
|
translations,
|
2019-03-15 12:44:49 +08:00
|
|
|
} from "pretty-text/emoji/data";
|
|
|
|
import { IMAGE_VERSION } from "pretty-text/emoji/version";
|
2019-03-13 20:02:56 +08:00
|
|
|
|
2022-03-06 01:58:49 +08:00
|
|
|
const extendedEmojiMap = new Map();
|
2019-03-13 20:02:56 +08:00
|
|
|
|
2020-03-31 02:16:10 +08:00
|
|
|
export function registerEmoji(code, url, group) {
|
2019-03-13 20:02:56 +08:00
|
|
|
code = code.toLowerCase();
|
2022-03-06 01:58:49 +08:00
|
|
|
extendedEmojiMap.set(code, { url, group });
|
2019-03-13 20:02:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export function extendedEmojiList() {
|
2022-03-06 01:58:49 +08:00
|
|
|
return extendedEmojiMap;
|
2019-03-13 20:02:56 +08:00
|
|
|
}
|
|
|
|
|
2022-03-06 01:58:49 +08:00
|
|
|
const emojiMap = new Map();
|
2019-03-13 20:02:56 +08:00
|
|
|
|
2022-04-22 14:42:15 +08:00
|
|
|
// Regex from https://github.com/mathiasbynens/emoji-test-regex-pattern/blob/main/dist/latest/javascript.txt
|
|
|
|
// plus some glyphs that are not in the emoji range: ☻|♡|
|
2021-04-22 14:43:06 +08:00
|
|
|
export const emojiReplacementRegex =
|
2022-04-22 14:42:15 +08:00
|
|
|
"☻|♡|[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uD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67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88
|
2019-12-04 00:32:33 +08:00
|
|
|
|
2021-04-22 14:43:06 +08:00
|
|
|
function textEmojiRegex(inlineEmoji) {
|
|
|
|
return inlineEmoji ? /:[^\s:]+(?::t\d)?:?/g : /\B:[^\s:]+(?::t\d)?:?\B/g;
|
2019-12-04 00:32:33 +08:00
|
|
|
}
|
2019-03-29 05:31:27 +08:00
|
|
|
|
2019-03-13 20:02:56 +08:00
|
|
|
// add all default emojis
|
2022-03-06 01:58:49 +08:00
|
|
|
emojis.forEach((code) => emojiMap.set(code, true));
|
2019-03-13 20:02:56 +08:00
|
|
|
|
|
|
|
// and their aliases
|
2022-03-06 01:58:49 +08:00
|
|
|
const aliasMap = new Map();
|
|
|
|
Object.entries(aliases).forEach(([name, list]) => {
|
|
|
|
list.forEach((alias) => aliasMap.set(alias, name));
|
2019-03-13 20:02:56 +08:00
|
|
|
});
|
|
|
|
|
2019-12-04 00:32:33 +08:00
|
|
|
function isReplacableInlineEmoji(string, index, inlineEmoji) {
|
2020-09-22 22:28:28 +08:00
|
|
|
if (inlineEmoji) {
|
|
|
|
return true;
|
|
|
|
}
|
2019-12-04 00:32:33 +08:00
|
|
|
|
|
|
|
// index depends on regex; when `inlineEmoji` is false, the regex starts
|
|
|
|
// with a `\B` character, so there's no need to subtract from the index
|
2020-05-07 22:25:23 +08:00
|
|
|
const beforeEmoji = string.slice(0, index);
|
2019-12-04 00:32:33 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
beforeEmoji.length === 0 ||
|
|
|
|
/(?:\s|[>.,\/#!$%^&*;:{}=\-_`~()])$/.test(beforeEmoji) ||
|
2021-04-22 14:43:06 +08:00
|
|
|
new RegExp(`(?:${emojiReplacementRegex})$`, "g").test(beforeEmoji)
|
2019-12-04 00:32:33 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-03-13 20:02:56 +08:00
|
|
|
export function performEmojiUnescape(string, opts) {
|
2020-03-31 02:16:10 +08:00
|
|
|
if (!string) {
|
2019-03-15 12:44:49 +08:00
|
|
|
return;
|
|
|
|
}
|
2019-03-13 20:02:56 +08:00
|
|
|
|
2020-05-28 02:11:52 +08:00
|
|
|
const allTranslations = Object.assign(
|
|
|
|
{},
|
|
|
|
translations,
|
|
|
|
opts.customEmojiTranslation || {}
|
|
|
|
);
|
2019-12-04 00:32:33 +08:00
|
|
|
|
2021-04-22 14:43:06 +08:00
|
|
|
const replacementFunction = (m, index) => {
|
2020-05-28 02:11:52 +08:00
|
|
|
const isEmoticon = opts.enableEmojiShortcuts && !!allTranslations[m];
|
2019-03-21 16:11:33 +08:00
|
|
|
const isUnicodeEmoticon = !!replacements[m];
|
|
|
|
let emojiVal;
|
2021-04-22 14:43:06 +08:00
|
|
|
|
2019-03-21 16:11:33 +08:00
|
|
|
if (isEmoticon) {
|
2020-05-28 02:11:52 +08:00
|
|
|
emojiVal = allTranslations[m];
|
2019-03-21 16:11:33 +08:00
|
|
|
} else if (isUnicodeEmoticon) {
|
|
|
|
emojiVal = replacements[m];
|
|
|
|
} else {
|
|
|
|
emojiVal = m.slice(1, m.length - 1);
|
|
|
|
}
|
|
|
|
const hasEndingColon = m.lastIndexOf(":") === m.length - 1;
|
|
|
|
const url = buildEmojiUrl(emojiVal, opts);
|
2020-08-24 20:20:51 +08:00
|
|
|
let classes = isCustomEmoji(emojiVal, opts)
|
2019-03-21 16:11:33 +08:00
|
|
|
? "emoji emoji-custom"
|
|
|
|
: "emoji";
|
|
|
|
|
2020-08-24 20:20:51 +08:00
|
|
|
if (opts.class) {
|
2022-03-06 01:58:49 +08:00
|
|
|
classes += ` ${opts.class}`;
|
2020-08-24 20:20:51 +08:00
|
|
|
}
|
|
|
|
|
2019-12-04 00:32:33 +08:00
|
|
|
const isReplacable =
|
|
|
|
(isEmoticon || hasEndingColon || isUnicodeEmoticon) &&
|
2021-04-22 14:43:06 +08:00
|
|
|
isReplacableInlineEmoji(string, index, opts.inlineEmoji);
|
2019-12-04 00:32:33 +08:00
|
|
|
|
2022-07-19 01:51:19 +08:00
|
|
|
const title = opts.title ?? emojiVal;
|
2019-12-04 00:32:33 +08:00
|
|
|
return url && isReplacable
|
2020-09-28 19:23:46 +08:00
|
|
|
? `<img width="20" height="20" src='${url}' ${
|
2022-07-19 01:51:19 +08:00
|
|
|
opts.skipTitle ? "" : `title='${title}'`
|
2020-09-28 19:23:46 +08:00
|
|
|
} ${
|
2020-08-24 20:20:51 +08:00
|
|
|
opts.lazy ? "loading='lazy' " : ""
|
2022-07-19 01:51:19 +08:00
|
|
|
}alt='${title}' class='${classes}'>`
|
2019-03-21 16:11:33 +08:00
|
|
|
: m;
|
2021-04-22 14:43:06 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
return string
|
|
|
|
.replace(new RegExp(emojiReplacementRegex, "g"), replacementFunction)
|
|
|
|
.replace(textEmojiRegex(opts.inlineEmoji), replacementFunction);
|
2019-03-21 16:11:33 +08:00
|
|
|
}
|
|
|
|
|
2019-05-21 22:56:51 +08:00
|
|
|
export function performEmojiEscape(string, opts) {
|
2020-05-28 02:11:52 +08:00
|
|
|
const allTranslations = Object.assign(
|
|
|
|
{},
|
|
|
|
translations,
|
|
|
|
opts.customEmojiTranslation || {}
|
|
|
|
);
|
2019-12-04 00:32:33 +08:00
|
|
|
|
2021-04-22 14:43:06 +08:00
|
|
|
const replacementFunction = (m, index) => {
|
|
|
|
if (isReplacableInlineEmoji(string, index, opts.inlineEmoji)) {
|
2020-05-28 02:11:52 +08:00
|
|
|
if (!!allTranslations[m]) {
|
|
|
|
return opts.emojiShortcuts ? `:${allTranslations[m]}:` : m;
|
2019-12-04 00:32:33 +08:00
|
|
|
} else if (!!replacements[m]) {
|
|
|
|
return `:${replacements[m]}:`;
|
|
|
|
}
|
2019-03-21 16:11:33 +08:00
|
|
|
}
|
2019-12-04 00:32:33 +08:00
|
|
|
|
|
|
|
return m;
|
2021-04-22 14:43:06 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
return string
|
|
|
|
.replace(new RegExp(emojiReplacementRegex, "g"), replacementFunction)
|
|
|
|
.replace(textEmojiRegex(opts.inlineEmoji), replacementFunction);
|
2019-03-13 20:02:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export function isCustomEmoji(code, opts) {
|
|
|
|
code = code.toLowerCase();
|
2022-03-06 01:58:49 +08:00
|
|
|
return extendedEmojiMap.has(code) || opts?.customEmoji?.hasOwnProperty(code);
|
2019-03-13 20:02:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export function buildEmojiUrl(code, opts) {
|
|
|
|
let url;
|
|
|
|
code = String(code).toLowerCase();
|
2022-03-06 01:58:49 +08:00
|
|
|
|
|
|
|
if (extendedEmojiMap.has(code)) {
|
|
|
|
url = extendedEmojiMap.get(code).url;
|
2019-03-13 20:02:56 +08:00
|
|
|
}
|
|
|
|
|
2022-03-06 01:58:49 +08:00
|
|
|
if (opts.customEmoji?.[code]) {
|
2020-03-31 02:16:10 +08:00
|
|
|
url = opts.customEmoji[code].url || opts.customEmoji[code];
|
2019-03-13 20:02:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const noToneMatch = code.match(/([^:]+):?/);
|
2021-03-03 03:04:16 +08:00
|
|
|
|
|
|
|
let emojiBasePath = "/images/emoji";
|
|
|
|
if (opts.emojiCDNUrl) {
|
|
|
|
emojiBasePath = opts.emojiCDNUrl;
|
|
|
|
}
|
|
|
|
|
2019-03-15 12:44:49 +08:00
|
|
|
if (
|
2022-03-06 01:58:49 +08:00
|
|
|
opts.getURL &&
|
|
|
|
opts.emojiSet &&
|
2019-03-15 12:44:49 +08:00
|
|
|
noToneMatch &&
|
|
|
|
!url &&
|
2022-03-06 01:58:49 +08:00
|
|
|
(emojiMap.has(noToneMatch[1]) || aliasMap.has(noToneMatch[1]))
|
2019-03-15 12:44:49 +08:00
|
|
|
) {
|
|
|
|
url = opts.getURL(
|
2021-03-03 03:04:16 +08:00
|
|
|
`${emojiBasePath}/${opts.emojiSet}/${code.replace(/:t/, "/")}.png`
|
2019-03-15 12:44:49 +08:00
|
|
|
);
|
2019-03-13 20:02:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (url) {
|
2022-03-06 01:58:49 +08:00
|
|
|
url = `${url}?v=${IMAGE_VERSION}`;
|
2019-03-13 20:02:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return url;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function emojiExists(code) {
|
|
|
|
code = code.toLowerCase();
|
2022-03-06 01:58:49 +08:00
|
|
|
return extendedEmojiMap.has(code) || emojiMap.has(code) || aliasMap.has(code);
|
2019-03-15 12:44:49 +08:00
|
|
|
}
|
2019-03-13 20:02:56 +08:00
|
|
|
|
|
|
|
let toSearch;
|
|
|
|
export function emojiSearch(term, options) {
|
2022-03-06 01:58:49 +08:00
|
|
|
const maxResults = options?.maxResults;
|
|
|
|
const diversity = options?.diversity;
|
2019-03-15 12:44:49 +08:00
|
|
|
if (maxResults === 0) {
|
|
|
|
return [];
|
|
|
|
}
|
2019-03-13 20:02:56 +08:00
|
|
|
|
2022-03-06 01:58:49 +08:00
|
|
|
if (!toSearch) {
|
|
|
|
toSearch = [
|
|
|
|
...emojiMap.keys(),
|
|
|
|
...extendedEmojiMap.keys(),
|
|
|
|
...aliasMap.keys(),
|
2020-09-02 02:45:44 +08:00
|
|
|
].sort();
|
2022-03-06 01:58:49 +08:00
|
|
|
}
|
2019-03-13 20:02:56 +08:00
|
|
|
|
|
|
|
const results = [];
|
|
|
|
|
|
|
|
function addResult(t) {
|
2022-03-06 01:58:49 +08:00
|
|
|
const val = aliasMap.get(t) || t;
|
|
|
|
if (!results.includes(val)) {
|
2021-02-02 00:36:35 +08:00
|
|
|
if (diversity && diversity > 1 && isSkinTonableEmoji(val)) {
|
|
|
|
results.push(`${val}:t${diversity}`);
|
|
|
|
} else {
|
|
|
|
results.push(val);
|
|
|
|
}
|
2019-03-13 20:02:56 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// if term matches from beginning
|
2022-03-06 01:58:49 +08:00
|
|
|
for (const item of toSearch) {
|
2022-07-18 02:16:39 +08:00
|
|
|
if (item.startsWith(term)) {
|
2020-09-22 22:28:28 +08:00
|
|
|
addResult(item);
|
|
|
|
}
|
2019-03-13 20:02:56 +08:00
|
|
|
}
|
|
|
|
|
2022-02-02 05:36:48 +08:00
|
|
|
for (const [key, value] of Object.entries(searchAliases)) {
|
|
|
|
if (key.startsWith(term)) {
|
|
|
|
for (const emoji of value) {
|
|
|
|
addResult(emoji);
|
|
|
|
}
|
2022-01-11 09:34:22 +08:00
|
|
|
}
|
2019-03-13 20:02:56 +08:00
|
|
|
}
|
|
|
|
|
2022-03-06 01:58:49 +08:00
|
|
|
for (const item of toSearch) {
|
2020-09-22 22:28:28 +08:00
|
|
|
if (item.indexOf(term) > 0) {
|
|
|
|
addResult(item);
|
|
|
|
}
|
2019-03-13 20:02:56 +08:00
|
|
|
}
|
|
|
|
|
2022-03-06 01:58:49 +08:00
|
|
|
if (maxResults) {
|
2019-03-13 20:02:56 +08:00
|
|
|
return results.slice(0, maxResults);
|
2022-03-06 01:58:49 +08:00
|
|
|
} else {
|
|
|
|
return results;
|
2019-03-13 20:02:56 +08:00
|
|
|
}
|
2019-03-15 12:44:49 +08:00
|
|
|
}
|
2019-03-13 20:02:56 +08:00
|
|
|
|
|
|
|
export function isSkinTonableEmoji(term) {
|
2020-09-02 04:47:22 +08:00
|
|
|
const match = term.split(":").filter(Boolean)[0];
|
2019-03-13 20:02:56 +08:00
|
|
|
if (match) {
|
2022-03-06 01:58:49 +08:00
|
|
|
return tonableEmojis.includes(match);
|
2019-03-13 20:02:56 +08:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|