about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/javascript/flavours/glitch/features/emoji_picker/index.js2
-rw-r--r--app/javascript/flavours/glitch/util/emoji/emoji_compressed.js11
-rw-r--r--app/javascript/flavours/glitch/util/emoji/emoji_mart_search_light.js20
-rw-r--r--app/javascript/flavours/glitch/util/emoji/emoji_picker.js4
4 files changed, 30 insertions, 7 deletions
diff --git a/app/javascript/flavours/glitch/features/emoji_picker/index.js b/app/javascript/flavours/glitch/features/emoji_picker/index.js
index 4cf833a3e..d22a50848 100644
--- a/app/javascript/flavours/glitch/features/emoji_picker/index.js
+++ b/app/javascript/flavours/glitch/features/emoji_picker/index.js
@@ -107,7 +107,7 @@ const mapDispatchToProps = (dispatch, { onPickEmoji }) => ({
 const assetHost = process.env.CDN_HOST || '';
 let EmojiPicker, Emoji; // load asynchronously
 
-const backgroundImageFn = () => `${assetHost}/emoji/sheet.png`;
+const backgroundImageFn = () => `${assetHost}/emoji/sheet_10.png`;
 const listenerOptions = detectPassiveEvents.hasSupport ? { passive: true } : false;
 
 const categoriesSort = [
diff --git a/app/javascript/flavours/glitch/util/emoji/emoji_compressed.js b/app/javascript/flavours/glitch/util/emoji/emoji_compressed.js
index e5b834a74..48d90201a 100644
--- a/app/javascript/flavours/glitch/util/emoji/emoji_compressed.js
+++ b/app/javascript/flavours/glitch/util/emoji/emoji_compressed.js
@@ -9,7 +9,14 @@ const { unicodeToFilename } = require('./unicode_to_filename');
 const { unicodeToUnifiedName } = require('./unicode_to_unified_name');
 const emojiMap         = require('./emoji_map.json');
 const { emojiIndex } = require('emoji-mart');
-const { default: emojiMartData } = require('emoji-mart/dist/data');
+const { uncompress: emojiMartUncompress } = require('emoji-mart/dist/utils/data');
+let data = require('emoji-mart/data/all.json');
+
+if(data.compressed) {
+  data = emojiMartUncompress(data);
+}
+const emojiMartData = data;
+
 
 const excluded       = ['®', '©', '™'];
 const skins          = ['🏻', '🏼', '🏽', '🏾', '🏿'];
@@ -88,6 +95,6 @@ module.exports = JSON.parse(JSON.stringify([
   shortCodesToEmojiData,
   emojiMartData.skins,
   emojiMartData.categories,
-  emojiMartData.short_names,
+  emojiMartData.aliases,
   emojisWithoutShortCodes,
 ]));
diff --git a/app/javascript/flavours/glitch/util/emoji/emoji_mart_search_light.js b/app/javascript/flavours/glitch/util/emoji/emoji_mart_search_light.js
index 5755bf1c4..bf511d290 100644
--- a/app/javascript/flavours/glitch/util/emoji/emoji_mart_search_light.js
+++ b/app/javascript/flavours/glitch/util/emoji/emoji_mart_search_light.js
@@ -8,6 +8,7 @@ let originalPool = {};
 let index = {};
 let emojisList = {};
 let emoticonsList = {};
+let customEmojisList = [];
 
 for (let emoji in data.emojis) {
   let emojiData = data.emojis[emoji];
@@ -28,7 +29,18 @@ for (let emoji in data.emojis) {
   originalPool[id] = emojiData;
 }
 
+function clearCustomEmojis(pool) {
+  customEmojisList.forEach((emoji) => {
+    let emojiId = emoji.id || emoji.short_names[0];
+
+    delete pool[emojiId];
+    delete emojisList[emojiId];
+  });
+}
+
 function addCustomToPool(custom, pool) {
+  if (customEmojisList.length) clearCustomEmojis(pool);
+
   custom.forEach((emoji) => {
     let emojiId = emoji.id || emoji.short_names[0];
 
@@ -37,10 +49,14 @@ function addCustomToPool(custom, pool) {
       emojisList[emojiId] = getSanitizedData(emoji);
     }
   });
+
+  customEmojisList = custom;
+  index = {};
 }
 
 function search(value, { emojisToShowFilter, maxResults, include, exclude, custom = [] } = {}) {
-  addCustomToPool(custom, originalPool);
+  if (customEmojisList !== custom)
+    addCustomToPool(custom, originalPool);
 
   maxResults = maxResults || 75;
   include = include || [];
@@ -143,7 +159,7 @@ function search(value, { emojisToShowFilter, maxResults, include, exclude, custo
 
   if (results) {
     if (emojisToShowFilter) {
-      results = results.filter((result) => emojisToShowFilter(data.emojis[result.id].unified));
+      results = results.filter((result) => emojisToShowFilter(data.emojis[result.id]));
     }
 
     if (results && results.length > maxResults) {
diff --git a/app/javascript/flavours/glitch/util/emoji/emoji_picker.js b/app/javascript/flavours/glitch/util/emoji/emoji_picker.js
index 7e145381e..044d38cb2 100644
--- a/app/javascript/flavours/glitch/util/emoji/emoji_picker.js
+++ b/app/javascript/flavours/glitch/util/emoji/emoji_picker.js
@@ -1,5 +1,5 @@
-import Picker from 'emoji-mart/dist-es/components/picker';
-import Emoji from 'emoji-mart/dist-es/components/emoji';
+import Picker from 'emoji-mart/dist-es/components/picker/picker';
+import Emoji from 'emoji-mart/dist-es/components/emoji/emoji';
 
 export {
   Picker,