diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-09-06 23:04:13 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-09-06 23:11:58 -0700 |
commit | d8bd57901e33a7057e26e782e295099ffcc0da89 (patch) | |
tree | e12dfc8cad42b1576756d19d7fbfd82646a009bf /webapp/utils/emoticons.jsx | |
parent | 7bc8e9a08dfde56387f946fdf5086252aa4d0491 (diff) | |
download | chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.gz chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.bz2 chat-d8bd57901e33a7057e26e782e295099ffcc0da89.zip |
Removing webapp
Diffstat (limited to 'webapp/utils/emoticons.jsx')
-rw-r--r-- | webapp/utils/emoticons.jsx | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/webapp/utils/emoticons.jsx b/webapp/utils/emoticons.jsx deleted file mode 100644 index 8a10e254e..000000000 --- a/webapp/utils/emoticons.jsx +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import EmojiStore from 'stores/emoji_store.jsx'; - -export const emoticonPatterns = { - slightly_smiling_face: /(^|\s)(:-?\))(?=$|\s)/g, // :) - wink: /(^|\s)(;-?\))(?=$|\s)/g, // ;) - open_mouth: /(^|\s)(:o)(?=$|\s)/gi, // :o - scream: /(^|\s)(:-o)(?=$|\s)/gi, // :-o - smirk: /(^|\s)(:-?])(?=$|\s)/g, // :] - smile: /(^|\s)(:-?d)(?=$|\s)/gi, // :D - stuck_out_tongue_closed_eyes: /(^|\s)(x-d)(?=$|\s)/gi, // x-d - stuck_out_tongue: /(^|\s)(:-?p)(?=$|\s)/gi, // :p - rage: /(^|\s)(:-?[[@])(?=$|\s)/g, // :@ - slightly_frowning_face: /(^|\s)(:-?\()(?=$|\s)/g, // :( - cry: /(^|\s)(:['’]-?\(|:'\(|:'\()(?=$|\s)/g, // :`( - confused: /(^|\s)(:-?\/)(?=$|\s)/g, // :/ - confounded: /(^|\s)(:-?s)(?=$|\s)/gi, // :s - neutral_face: /(^|\s)(:-?\|)(?=$|\s)/g, // :| - flushed: /(^|\s)(:-?\$)(?=$|\s)/g, // :$ - mask: /(^|\s)(:-x)(?=$|\s)/gi, // :-x - heart: /(^|\s)(<3|<3)(?=$|\s)/g, // <3 - broken_heart: /(^|\s)(<\/3|</3)(?=$|\s)/g, // </3 - thumbsup: /(^|\s)(:\+1:)(?=$|\s)/g, // :+1: - thumbsdown: /(^|\s)(:-1:)(?=$|\s)/g // :-1: -}; - -export const EMOJI_PATTERN = /(:([a-zA-Z0-9_-]+):)/g; - -export function handleEmoticons(text, tokens, emojis) { - let output = text; - - function replaceEmoticonWithToken(fullMatch, prefix, matchText, name) { - const index = tokens.size; - const alias = `$MM_EMOTICON${index}`; - - if (emojis.has(name)) { - const path = EmojiStore.getEmojiImageUrl(emojis.get(name)); - - // we have an image path so we found a matching emoticon - tokens.set(alias, { - value: `<span alt="${matchText}" class="emoticon" title="${matchText}" style="background-image:url(${path})"></span>`, - originalText: fullMatch - }); - - return prefix + alias; - } - - return fullMatch; - } - - // match named emoticons like :goat: - output = output.replace(EMOJI_PATTERN, (fullMatch, matchText, name) => replaceEmoticonWithToken(fullMatch, '', matchText, name)); - - // match text smilies like :D - for (const name of Object.keys(emoticonPatterns)) { - const pattern = emoticonPatterns[name]; - - // this might look a bit funny, but since the name isn't contained in the actual match - // like with the named emoticons, we need to add it in manually - output = output.replace(pattern, (fullMatch, prefix, matchText) => replaceEmoticonWithToken(fullMatch, prefix, matchText, name)); - } - - return output; -} |