Browse Source

Fix emoji order bug

master
Joe Attardi 3 years ago
parent
commit
4b1464e3e6
  1. 6
      scripts/processEmojiData.js
  2. 26
      src/emojiArea.ts

6
scripts/processEmojiData.js

@ -10,14 +10,14 @@ const categoryKeys = {
'People & Body': 'people',
'Animals & Nature': 'animals',
'Food & Drink': 'food',
'Travel & Places': 'travel',
'Activities': 'activities',
'Travel & Places': 'travel',
'Objects': 'objects',
'Symbols': 'symbols',
'Flags': 'flags'
};
const BLACKLIST = [
const EXCLUDE_LIST = [
'light skin tone',
'medium-light skin tone',
'medium skin tone',
@ -100,7 +100,7 @@ interface.on('close', () => {
data.emoji = data.emoji.filter(e => !toDelete.includes(e));
toDelete = [];
BLACKLIST.forEach(name => toDelete.push(data.emoji.find(e => e.name === name)));
EXCLUDE_LIST.forEach(name => toDelete.push(data.emoji.find(e => e.name === name)));
const emojisWithVariations = data.emoji.filter(emoji => emoji.name.includes(':') && !emoji.name.startsWith('family'));
emojisWithVariations.forEach(emoji => {

26
src/emojiArea.ts

@ -24,15 +24,19 @@ import {
import { createElement } from './util';
import { load } from './recent';
// const emojiCategories: { [key: string]: EmojiRecord[] } = {};
// emojiData.emoji.forEach(emoji => {
// let categoryList = emojiCategories[emojiData.categories[emoji.category]];
// if (!categoryList) {
// categoryList = emojiCategories[emojiData.categories[emoji.category]] = [];
// }
// categoryList.push(emoji);
// });
const categorySortOrder = [
'recents',
'smileys',
'people',
'animals',
'food',
'activities',
'travel',
'objects',
'symbols',
'flags',
'custom'
];
export class EmojiArea {
private headerOffsets: number[];
@ -66,6 +70,10 @@ export class EmojiArea {
if (options.custom) {
this.categories = [...this.categories, 'custom'];
}
this.categories.sort(
(a, b) => categorySortOrder.indexOf(a) - categorySortOrder.indexOf(b)
);
}
updateRecents(): void {

Loading…
Cancel
Save