|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| export const EMOJI_SHORTCODES = {
|
|
|
| grinning: '๐', grinning_face: '๐',
|
| smiley: '๐', smiley_face: '๐',
|
| smile: '๐',
|
| grin: '๐',
|
| laughing: '๐', satisfied: '๐',
|
| sweat_smile: '๐
',
|
| rofl: '๐คฃ', rolling_on_the_floor_laughing: '๐คฃ',
|
| joy: '๐',
|
| slightly_smiling_face: '๐', slight_smile: '๐',
|
| upside_down_face: '๐', upside_down: '๐',
|
| wink: '๐', winking_face: '๐',
|
| blush: '๐', smiling_face_with_smiling_eyes: '๐',
|
| innocent: '๐',
|
| smiling_face_with_three_hearts: '๐ฅฐ',
|
| heart_eyes: '๐', heart_eyes_face: '๐',
|
| star_struck: '๐คฉ',
|
| kissing_heart: '๐',
|
| kissing: '๐',
|
| kissing_closed_eyes: '๐',
|
| kissing_smiling_eyes: '๐',
|
| yum: '๐',
|
| stuck_out_tongue: '๐',
|
| stuck_out_tongue_winking_eye: '๐',
|
| zany_face: '๐คช',
|
| stuck_out_tongue_closed_eyes: '๐',
|
| money_mouth_face: '๐ค',
|
| hugs: '๐ค', hugging_face: '๐ค',
|
| hand_over_mouth: '๐คญ',
|
| shushing_face: '๐คซ',
|
| thinking: '๐ค', thinking_face: '๐ค',
|
| zipper_mouth_face: '๐ค',
|
| raised_eyebrow: '๐คจ',
|
| neutral_face: '๐',
|
| expressionless: '๐',
|
| no_mouth: '๐ถ',
|
| smirk: '๐', smirk_face: '๐',
|
| unamused: '๐',
|
| roll_eyes: '๐', face_with_rolling_eyes: '๐',
|
| grimacing: '๐ฌ',
|
| lying_face: '๐คฅ',
|
| relieved: '๐',
|
| pensive: '๐',
|
| sleepy: '๐ช',
|
| drooling_face: '๐คค',
|
| sleeping: '๐ด',
|
| mask: '๐ท',
|
| face_with_thermometer: '๐ค',
|
| face_with_head_bandage: '๐ค',
|
| nauseated_face: '๐คข',
|
| vomiting_face: '๐คฎ',
|
| sneezing_face: '๐คง',
|
| hot_face: '๐ฅต',
|
| cold_face: '๐ฅถ',
|
| woozy_face: '๐ฅด',
|
| dizzy_face: '๐ต',
|
| exploding_head: '๐คฏ',
|
| cowboy_hat_face: '๐ค ',
|
| partying_face: '๐ฅณ',
|
| sunglasses: '๐',
|
| nerd_face: '๐ค',
|
| monocle_face: '๐ง',
|
| confused: '๐',
|
| worried: '๐',
|
| slightly_frowning_face: '๐',
|
| frowning_face: 'โน๏ธ',
|
| open_mouth: '๐ฎ',
|
| hushed: '๐ฏ',
|
| astonished: '๐ฒ',
|
| flushed: '๐ณ',
|
| pleading_face: '๐ฅบ',
|
| frowning: '๐ฆ',
|
| anguished: '๐ง',
|
| fearful: '๐จ',
|
| cold_sweat: '๐ฐ',
|
| disappointed_relieved: '๐ฅ',
|
| cry: '๐ข',
|
| sob: '๐ญ',
|
| scream: '๐ฑ',
|
| confounded: '๐',
|
| persevere: '๐ฃ',
|
| disappointed: '๐',
|
| sweat: '๐',
|
| weary: '๐ฉ',
|
| tired_face: '๐ซ',
|
| yawning_face: '๐ฅฑ',
|
| triumph: '๐ค',
|
| rage: '๐ก', pout: '๐ก', pouting_face: '๐ก',
|
| angry: '๐ ',
|
| cursing_face: '๐คฌ',
|
| smiling_imp: '๐',
|
| imp: '๐ฟ',
|
| skull: '๐',
|
| skull_and_crossbones: 'โ ๏ธ',
|
| hankey: '๐ฉ', poop: '๐ฉ', shit: '๐ฉ',
|
| clown_face: '๐คก',
|
| japanese_ogre: '๐น',
|
| japanese_goblin: '๐บ',
|
| ghost: '๐ป',
|
| alien: '๐ฝ',
|
| space_invader: '๐พ',
|
| robot: '๐ค', robot_face: '๐ค',
|
|
|
| smiley_cat: '๐บ',
|
| smile_cat: '๐ธ',
|
| joy_cat: '๐น',
|
| heart_eyes_cat: '๐ป',
|
| smirk_cat: '๐ผ',
|
| kissing_cat: '๐ฝ',
|
| scream_cat: '๐',
|
| crying_cat_face: '๐ฟ',
|
| pouting_cat: '๐พ',
|
| see_no_evil: '๐',
|
| hear_no_evil: '๐',
|
| speak_no_evil: '๐',
|
|
|
| wave: '๐', wave_hand: '๐',
|
| raised_back_of_hand: '๐ค',
|
| raised_hand_with_fingers_splayed: '๐๏ธ',
|
| hand: 'โ', raised_hand: 'โ',
|
| vulcan_salute: '๐',
|
| ok_hand: '๐',
|
| pinched_fingers: '๐ค',
|
| pinching_hand: '๐ค',
|
| v: 'โ๏ธ', victory_hand: 'โ๏ธ',
|
| crossed_fingers: '๐ค',
|
| love_you_gesture: '๐ค',
|
| metal: '๐ค',
|
| call_me_hand: '๐ค',
|
| point_left: '๐',
|
| point_right: '๐',
|
| point_up_2: '๐',
|
| middle_finger: '๐', fu: '๐',
|
| point_down: '๐',
|
| point_up: 'โ๏ธ',
|
| '+1': '๐', thumbsup: '๐', thumbup: '๐', thumbs_up: '๐',
|
| '-1': '๐', thumbsdown: '๐', thumbdown: '๐', thumbs_down: '๐',
|
| fist_raised: 'โ', fist: 'โ',
|
| fist_oncoming: '๐', facepunch: '๐', punch: '๐',
|
| fist_left: '๐ค',
|
| fist_right: '๐ค',
|
| clap: '๐', clapping_hands: '๐',
|
| raised_hands: '๐',
|
| open_hands: '๐',
|
| palms_up_together: '๐คฒ',
|
| handshake: '๐ค',
|
| pray: '๐', folded_hands: '๐',
|
| writing_hand: 'โ๏ธ',
|
| nail_care: '๐
',
|
| selfie: '๐คณ',
|
| muscle: '๐ช', flexed_biceps: '๐ช',
|
|
|
| heart: 'โค๏ธ', red_heart: 'โค๏ธ',
|
| orange_heart: '๐งก',
|
| yellow_heart: '๐',
|
| green_heart: '๐',
|
| blue_heart: '๐',
|
| purple_heart: '๐',
|
| black_heart: '๐ค',
|
| white_heart: '๐ค',
|
| brown_heart: '๐ค',
|
| broken_heart: '๐',
|
| heart_on_fire: 'โค๏ธโ๐ฅ',
|
| two_hearts: '๐',
|
| revolving_hearts: '๐',
|
| heartbeat: '๐',
|
| heartpulse: '๐',
|
| sparkling_heart: '๐',
|
| cupid: '๐',
|
| gift_heart: '๐',
|
| heart_decoration: '๐',
|
| heavy_heart_exclamation: 'โฃ๏ธ',
|
|
|
| fire: '๐ฅ', flame: '๐ฅ',
|
| '100': '๐ฏ', hundred: '๐ฏ',
|
| sparkles: 'โจ',
|
| star: 'โญ',
|
| star2: '๐', glowing_star: '๐',
|
| dizzy: '๐ซ',
|
| boom: '๐ฅ', collision: '๐ฅ',
|
| anger: '๐ข',
|
| sweat_drops: '๐ฆ',
|
| dash: '๐จ',
|
| zzz: '๐ค',
|
| tada: '๐', party_popper: '๐',
|
| confetti_ball: '๐',
|
| balloon: '๐',
|
| gift: '๐',
|
| trophy: '๐',
|
| '1st_place_medal': '๐ฅ',
|
| '2nd_place_medal': '๐ฅ',
|
| '3rd_place_medal': '๐ฅ',
|
| medal_sports: '๐
',
|
| zap: 'โก', lightning: 'โก',
|
| bulb: '๐ก', light_bulb: '๐ก',
|
| key: '๐',
|
| lock: '๐',
|
| unlock: '๐',
|
| bell: '๐',
|
| no_bell: '๐',
|
| loudspeaker: '๐ข',
|
| mega: '๐ฃ', megaphone: '๐ฃ',
|
| speech_balloon: '๐ฌ',
|
| thought_balloon: '๐ญ',
|
| white_check_mark: 'โ
',
|
| heavy_check_mark: 'โ๏ธ', check_mark: 'โ๏ธ',
|
| ballot_box_with_check: 'โ๏ธ',
|
| x: 'โ', cross_mark: 'โ',
|
| negative_squared_cross_mark: 'โ',
|
| question: 'โ',
|
| grey_question: 'โ',
|
| exclamation: 'โ', heavy_exclamation_mark: 'โ',
|
| grey_exclamation: 'โ',
|
| warning: 'โ ๏ธ',
|
| no_entry: 'โ',
|
| no_entry_sign: '๐ซ',
|
| red_circle: '๐ด',
|
| green_circle: '๐ข',
|
| large_blue_circle: '๐ต',
|
| yellow_circle: '๐ก',
|
| white_circle: 'โช',
|
| black_circle: 'โซ',
|
| orange_circle: '๐ ',
|
| purple_circle: '๐ฃ',
|
| brown_circle: '๐ค',
|
|
|
| rocket: '๐',
|
| eyes: '๐',
|
| eye: '๐๏ธ',
|
| brain: '๐ง ',
|
| books: '๐',
|
| book: '๐', open_book: '๐',
|
| memo: '๐', pencil: '๐',
|
| pencil2: 'โ๏ธ',
|
| page_facing_up: '๐',
|
| paperclip: '๐',
|
| pushpin: '๐',
|
| round_pushpin: '๐',
|
| link: '๐',
|
| bar_chart: '๐',
|
| chart_with_upwards_trend: '๐',
|
| chart_with_downwards_trend: '๐',
|
| mag: '๐',
|
| mag_right: '๐',
|
| globe_with_meridians: '๐',
|
| earth_africa: '๐',
|
| earth_americas: '๐',
|
| earth_asia: '๐',
|
| alarm_clock: 'โฐ',
|
| hourglass_flowing_sand: 'โณ',
|
| hourglass: 'โ',
|
| microphone: '๐ค', mic: '๐ค',
|
| musical_note: '๐ต',
|
| notes: '๐ถ', musical_notes: '๐ถ',
|
| headphones: '๐ง',
|
| camera: '๐ท',
|
| camera_flash: '๐ธ',
|
| clapper: '๐ฌ',
|
| tv: '๐บ',
|
| computer: '๐ป', laptop: '๐ป',
|
| desktop_computer: '๐ฅ๏ธ',
|
| iphone: '๐ฑ', mobile_phone: '๐ฑ',
|
| telephone: 'โ๏ธ',
|
| wrench: '๐ง',
|
| hammer: '๐จ',
|
| gear: 'โ๏ธ',
|
| nut_and_bolt: '๐ฉ',
|
| magnet: '๐งฒ',
|
| test_tube: '๐งช',
|
| microscope: '๐ฌ',
|
| dart: '๐ฏ', bullseye: '๐ฏ',
|
| game_die: '๐ฒ',
|
| jigsaw: '๐งฉ',
|
|
|
| pizza: '๐',
|
| hamburger: '๐',
|
| fries: '๐',
|
| taco: '๐ฎ',
|
| sushi: '๐ฃ',
|
| doughnut: '๐ฉ', donut: '๐ฉ',
|
| coffee: 'โ',
|
| beer: '๐บ',
|
| wine_glass: '๐ท',
|
|
|
| dog: '๐ถ',
|
| cat: '๐ฑ',
|
| mouse: '๐ญ',
|
| hamster: '๐น',
|
| rabbit: '๐ฐ',
|
| fox_face: '๐ฆ',
|
| bear: '๐ป',
|
| panda_face: '๐ผ',
|
| koala: '๐จ',
|
| tiger: '๐ฏ',
|
| lion: '๐ฆ',
|
| cow: '๐ฎ',
|
| pig: '๐ท',
|
| frog: '๐ธ',
|
| monkey_face: '๐ต',
|
| chicken: '๐',
|
| penguin: '๐ง',
|
| bird: '๐ฆ',
|
| eagle: '๐ฆ
',
|
| duck: '๐ฆ',
|
| owl: '๐ฆ',
|
| wolf: '๐บ',
|
| horse: '๐ด',
|
| unicorn: '๐ฆ',
|
| bee: '๐', honeybee: '๐',
|
| bug: '๐',
|
| butterfly: '๐ฆ',
|
| snail: '๐',
|
| lady_beetle: '๐',
|
| snake: '๐',
|
| turtle: '๐ข',
|
| octopus: '๐',
|
| crab: '๐ฆ',
|
| tropical_fish: '๐ ',
|
| whale: '๐ณ',
|
| shark: '๐ฆ',
|
| cherry_blossom: '๐ธ',
|
| rose: '๐น',
|
| sunflower: '๐ป',
|
| hibiscus: '๐บ',
|
| tulip: '๐ท',
|
| seedling: '๐ฑ',
|
| evergreen_tree: '๐ฒ',
|
| deciduous_tree: '๐ณ',
|
| four_leaf_clover: '๐',
|
| apple: '๐',
|
| green_apple: '๐',
|
| pear: '๐',
|
| tangerine: '๐',
|
| lemon: '๐',
|
| banana: '๐',
|
| watermelon: '๐',
|
| grapes: '๐',
|
| strawberry: '๐',
|
| blueberries: '๐ซ',
|
| peach: '๐',
|
| rainbow: '๐',
|
| sunny: 'โ๏ธ', sun: 'โ๏ธ',
|
| partly_sunny: 'โ
',
|
| cloud: 'โ๏ธ',
|
| snowflake: 'โ๏ธ',
|
| ocean: '๐',
|
|
|
| arrow_right: 'โก๏ธ',
|
| arrow_left: 'โฌ
๏ธ',
|
| arrow_up: 'โฌ๏ธ',
|
| arrow_down: 'โฌ๏ธ',
|
| arrow_upper_right: 'โ๏ธ',
|
| arrow_lower_right: 'โ๏ธ',
|
| arrow_lower_left: 'โ๏ธ',
|
| arrow_upper_left: 'โ๏ธ',
|
| leftwards_arrow_with_hook: 'โฉ๏ธ',
|
| arrow_right_hook: 'โช๏ธ',
|
| arrows_counterclockwise: '๐',
|
| arrows_clockwise: '๐',
|
| heavy_plus_sign: 'โ',
|
| heavy_minus_sign: 'โ',
|
| heavy_division_sign: 'โ',
|
| heavy_multiplication_x: 'โ๏ธ',
|
| infinity: 'โพ๏ธ',
|
| copyright: 'ยฉ๏ธ',
|
| registered: 'ยฎ๏ธ',
|
| tm: 'โข๏ธ',
|
| recycle: 'โป๏ธ',
|
| checkered_flag: '๐',
|
| triangular_flag_on_post: '๐ฉ',
|
| white_flag: '๐ณ๏ธ',
|
| black_flag: '๐ด',
|
|
|
| baby: '๐ถ',
|
| boy: '๐ฆ',
|
| girl: '๐ง',
|
| man: '๐จ',
|
| woman: '๐ฉ',
|
| older_man: '๐ด',
|
| older_woman: '๐ต',
|
| crown: '๐',
|
| gem: '๐',
|
| graduation_cap: '๐', mortar_board: '๐',
|
| };
|
|
|
|
|
|
|
|
|
|
|
| const SHORTCODE_RE = /:([a-z0-9_+-]{1,40}):/gi;
|
|
|
| |
| |
| |
|
|
| export function hasEmojiShortcode(text) {
|
| return !!text && text.indexOf(':') !== -1 && /:[a-z0-9_+-]{1,40}:/i.test(text);
|
| }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| const _WORDISH = /[A-Za-z0-9_]/;
|
| function _boundedOnBothSides(str, start, end) {
|
| const before = start > 0 ? str[start - 1] : '';
|
| const after = end < str.length ? str[end] : '';
|
| return !_WORDISH.test(before) && !_WORDISH.test(after);
|
| }
|
|
|
| |
| |
| |
| |
| |
|
|
| export function replaceEmojiShortcodes(text) {
|
| if (!text || text.indexOf(':') === -1) return text;
|
| return text.replace(SHORTCODE_RE, (whole, name, offset, str) => {
|
| const key = name.toLowerCase();
|
| if (!Object.prototype.hasOwnProperty.call(EMOJI_SHORTCODES, key)) return whole;
|
|
|
|
|
| if (!_boundedOnBothSides(str, offset, offset + whole.length)) return whole;
|
| return EMOJI_SHORTCODES[key];
|
| });
|
| }
|
|
|
| export default { EMOJI_SHORTCODES, replaceEmojiShortcodes, hasEmojiShortcode };
|
|
|