Replace dashes to underscores in emoji autocompletion

This commit is contained in:
Pavel Djundik 2020-08-13 10:47:50 +03:00
parent b6782da837
commit 19d6b7d98f
2 changed files with 12 additions and 5 deletions

View File

@ -613,7 +613,7 @@
"dragon_face": "🐲", "dragon_face": "🐲",
"dragon": "🐉", "dragon": "🐉",
"sauropod": "🦕", "sauropod": "🦕",
"t-rex": "🦖", "t_rex": "🦖",
"whale": "🐳", "whale": "🐳",
"whale2": "🐋", "whale2": "🐋",
"dolphin": "🐬", "dolphin": "🐬",
@ -1082,7 +1082,7 @@
"game_die": "🎲", "game_die": "🎲",
"jigsaw": "🧩", "jigsaw": "🧩",
"teddy_bear": "🧸", "teddy_bear": "🧸",
"pi_ata": "🪅", "pinata": "🪅",
"nesting_dolls": "🪆", "nesting_dolls": "🪆",
"spades": "♠️", "spades": "♠️",
"hearts": "♥️", "hearts": "♥️",
@ -1240,7 +1240,7 @@
"chart": "💹", "chart": "💹",
"email": "✉️", "email": "✉️",
"envelope": "✉️", "envelope": "✉️",
"e-mail": "📧", "e_mail": "📧",
"incoming_envelope": "📨", "incoming_envelope": "📨",
"envelope_with_arrow": "📩", "envelope_with_arrow": "📩",
"outbox_tray": "📤", "outbox_tray": "📤",
@ -1376,7 +1376,7 @@
"no_bicycles": "🚳", "no_bicycles": "🚳",
"no_smoking": "🚭", "no_smoking": "🚭",
"do_not_litter": "🚯", "do_not_litter": "🚯",
"non-potable_water": "🚱", "non_potable_water": "🚱",
"no_pedestrians": "🚷", "no_pedestrians": "🚷",
"no_mobile_phones": "📵", "no_mobile_phones": "📵",
"underage": "🔞", "underage": "🔞",

View File

@ -19,7 +19,14 @@ const emojiModifiersRegex = /[\u{1f3fb}-\u{1f3ff}]|\u{fe0f}/gu;
const cleanEmoji = emoji.emoji.replace(emojiModifiersRegex, ""); const cleanEmoji = emoji.emoji.replace(emojiModifiersRegex, "");
fullNameEmojiMap[cleanEmoji] = emoji.description; fullNameEmojiMap[cleanEmoji] = emoji.description;
for (const alias of emoji.aliases) { for (let alias of emoji.aliases) {
if (alias !== "-1") {
// Replace dashes to underscores except for :-1:
// This removes autocompletion prompt for :-P
// prompting for :non-potable_water:
alias = alias.replace(/-/g, "_");
}
emojiMap[alias] = emoji.emoji; emojiMap[alias] = emoji.emoji;
} }
} }