diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-06-23 14:08:06 -0500 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-06-23 14:23:20 -0500 |
commit | d099744dd41af983e5a02f64375b60a8cf6c539f (patch) | |
tree | 5da66cf0627f47eca8cb929fe4bc80a6b2cad1d1 /app/assets/javascripts | |
parent | 5a044dc25b1c04da6253577a3934e857a0c0bd0d (diff) | |
download | gitlab-ce-d099744dd41af983e5a02f64375b60a8cf6c539f.tar.gz |
centralize emoji helper methods
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/awards_handler.js | 5 | ||||
-rw-r--r-- | app/assets/javascripts/behaviors/gl_emoji.js | 5 | ||||
-rw-r--r-- | app/assets/javascripts/emoji/index.js | 13 | ||||
-rw-r--r-- | app/assets/javascripts/emoji/is_emoji_name_valid.js (renamed from app/assets/javascripts/behaviors/gl_emoji/is_emoji_name_valid.js) | 0 | ||||
-rw-r--r-- | app/assets/javascripts/emoji/is_emoji_unicode_supported.js (renamed from app/assets/javascripts/behaviors/gl_emoji/is_emoji_unicode_supported.js) | 2 | ||||
-rw-r--r-- | app/assets/javascripts/emoji/unicode_support_map.js (renamed from app/assets/javascripts/behaviors/gl_emoji/unicode_support_map.js) | 9 | ||||
-rw-r--r-- | app/assets/javascripts/gfm_auto_complete.js | 9 |
7 files changed, 22 insertions, 21 deletions
diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js index ebe722061d7..b6a12d09042 100644 --- a/app/assets/javascripts/awards_handler.js +++ b/app/assets/javascripts/awards_handler.js @@ -2,11 +2,8 @@ /* global Flash */ import Cookies from 'js-cookie'; - -import emojiMap from 'emojis/digests.json'; -import emojiAliases from 'emojis/aliases.json'; import { glEmojiTag } from './behaviors/gl_emoji'; -import isEmojiNameValid from './behaviors/gl_emoji/is_emoji_name_valid'; +import { emojiMap, emojiAliases, isEmojiNameValid } from './emoji'; const animationEndEventString = 'animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd'; const transitionEndEventString = 'transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'; diff --git a/app/assets/javascripts/behaviors/gl_emoji.js b/app/assets/javascripts/behaviors/gl_emoji.js index ca6117c4fd6..06eb698378c 100644 --- a/app/assets/javascripts/behaviors/gl_emoji.js +++ b/app/assets/javascripts/behaviors/gl_emoji.js @@ -1,8 +1,5 @@ import installCustomElements from 'document-register-element'; -import emojiMap from 'emojis/digests.json'; -import emojiAliases from 'emojis/aliases.json'; -import { getUnicodeSupportMap } from './gl_emoji/unicode_support_map'; -import { isEmojiUnicodeSupported } from './gl_emoji/is_emoji_unicode_supported'; +import { emojiMap, emojiAliases, isEmojiUnicodeSupported, getUnicodeSupportMap } from '../emoji'; installCustomElements(window); diff --git a/app/assets/javascripts/emoji/index.js b/app/assets/javascripts/emoji/index.js new file mode 100644 index 00000000000..1e86ce822d2 --- /dev/null +++ b/app/assets/javascripts/emoji/index.js @@ -0,0 +1,13 @@ +import emojiMap from 'emojis/digests.json'; +import emojiAliases from 'emojis/aliases.json'; +import getUnicodeSupportMap from './unicode_support_map'; +import isEmojiNameValid from './is_emoji_name_valid'; +import isEmojiUnicodeSupported from './is_emoji_unicode_supported'; + +export { + emojiMap, + emojiAliases, + getUnicodeSupportMap, + isEmojiNameValid, + isEmojiUnicodeSupported, +}; diff --git a/app/assets/javascripts/behaviors/gl_emoji/is_emoji_name_valid.js b/app/assets/javascripts/emoji/is_emoji_name_valid.js index be4aeb32c46..be4aeb32c46 100644 --- a/app/assets/javascripts/behaviors/gl_emoji/is_emoji_name_valid.js +++ b/app/assets/javascripts/emoji/is_emoji_name_valid.js diff --git a/app/assets/javascripts/behaviors/gl_emoji/is_emoji_unicode_supported.js b/app/assets/javascripts/emoji/is_emoji_unicode_supported.js index 4f8884d05ac..3fd23efa9f8 100644 --- a/app/assets/javascripts/behaviors/gl_emoji/is_emoji_unicode_supported.js +++ b/app/assets/javascripts/emoji/is_emoji_unicode_supported.js @@ -111,7 +111,7 @@ function isEmojiUnicodeSupported(unicodeSupportMap = {}, emojiUnicode, unicodeVe } export { - isEmojiUnicodeSupported, + isEmojiUnicodeSupported as default, isFlagEmoji, isKeycapEmoji, isSkinToneComboEmoji, diff --git a/app/assets/javascripts/behaviors/gl_emoji/unicode_support_map.js b/app/assets/javascripts/emoji/unicode_support_map.js index 257df55e54f..2a0c013a70c 100644 --- a/app/assets/javascripts/behaviors/gl_emoji/unicode_support_map.js +++ b/app/assets/javascripts/emoji/unicode_support_map.js @@ -1,4 +1,4 @@ -import AccessorUtilities from '../../lib/utils/accessor'; +import AccessorUtilities from '../lib/utils/accessor'; const unicodeSupportTestMap = { // man, student (emojione does not have any of these yet), http://emojipedia.org/emoji-zwj-sequences/ @@ -140,7 +140,7 @@ function generateUnicodeSupportMap(testMap) { return resultMap; } -function getUnicodeSupportMap() { +export default function getUnicodeSupportMap() { let unicodeSupportMap; let userAgentFromCache; @@ -165,8 +165,3 @@ function getUnicodeSupportMap() { return unicodeSupportMap; } - -export { - getUnicodeSupportMap, - generateUnicodeSupportMap, -}; diff --git a/app/assets/javascripts/gfm_auto_complete.js b/app/assets/javascripts/gfm_auto_complete.js index 105762cb1ba..64d47a0d75e 100644 --- a/app/assets/javascripts/gfm_auto_complete.js +++ b/app/assets/javascripts/gfm_auto_complete.js @@ -1,8 +1,7 @@ -import emojiMap from 'emojis/digests.json'; -import emojiAliases from 'emojis/aliases.json'; -import { glEmojiTag } from '~/behaviors/gl_emoji'; -import glRegexp from '~/lib/utils/regexp'; -import AjaxCache from '~/lib/utils/ajax_cache'; +import { glEmojiTag } from './behaviors/gl_emoji'; +import { emojiMap, emojiAliases } from './emoji'; +import glRegexp from './lib/utils/regexp'; +import AjaxCache from './lib/utils/ajax_cache'; function sanitize(str) { return str.replace(/<(?:.|\n)*?>/gm, ''); |