mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-21 11:05:08 +01:00
c190b720d3
* Update CHANGELOG.md * Feat:emoji picker folder select * Fix: lint error * Fix: lint error 2 * Fix: lint error 3 * カスタム絵文字のカテゴリ表示部分が長かったので短くした * エフェクトが壊れて出ないのを修正 * padding 18px -> 9px * Update CHANGELOG.md * Revert: en-US.yml * chg: Folder -> folder * chg: isChildrenExits -> isChildren * chg: isChildren -> categoryFolderFlag * カテゴリ末尾が / の場合ピッカーから消失するので「その他」と扱い対応 * 特定のパターンのカテゴリ名でピッカーに出てこないのを修正 「i18n.ts.other」や「/」始まりの場合壊れる * chg: categoryFolderFlag -> hasChildSection * code format * Del: ti-fw * fix * 絵文字とフォルダの表示順序入れ替え * ネストした場合にパネルでどこまでがどのフォルダのものかをわかりやすくした * fix lint * カテゴリの名前が長いと表示がおかしくなる問題を修正 Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com> --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp> Co-authored-by: atsuchan <83960488+atsu1125@users.noreply.github.com> Co-authored-by: Masaya Suzuki <15100604+massongit@users.noreply.github.com> Co-authored-by: Kagami Sascha Rosylight <saschanaz@outlook.com> Co-authored-by: taiy <53635909+taiyme@users.noreply.github.com> Co-authored-by: xianon <xianon@hotmail.co.jp> Co-authored-by: kabo2468 <28654659+kabo2468@users.noreply.github.com> Co-authored-by: YS <47836716+yszkst@users.noreply.github.com> Co-authored-by: Khsmty <me@khsmty.com> Co-authored-by: Soni L <EnderMoneyMod@gmail.com> Co-authored-by: mei23 <m@m544.net> Co-authored-by: daima3629 <52790780+daima3629@users.noreply.github.com> Co-authored-by: Windymelt <1113940+windymelt@users.noreply.github.com> Co-authored-by: Ebise Lutica <7106976+EbiseLutica@users.noreply.github.com> Co-authored-by: nenohi <kimutipartylove@gmail.com> Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com> Co-authored-by: rinsuki <428rinsuki+git@gmail.com> Co-authored-by: FineArchs <133759614+FineArchs@users.noreply.github.com> Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com>
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
export const unicodeEmojiCategories = ['face', 'people', 'animals_and_nature', 'food_and_drink', 'activity', 'travel_and_places', 'objects', 'symbols', 'flags'] as const;
|
|
|
|
export type UnicodeEmojiDef = {
|
|
name: string;
|
|
char: string;
|
|
category: typeof unicodeEmojiCategories[number];
|
|
}
|
|
|
|
// initial converted from https://github.com/muan/emojilib/commit/242fe68be86ed6536843b83f7e32f376468b38fb
|
|
import _emojilist from '../emojilist.json';
|
|
|
|
export const emojilist: UnicodeEmojiDef[] = _emojilist.map(x => ({
|
|
name: x[1] as string,
|
|
char: x[0] as string,
|
|
category: unicodeEmojiCategories[x[2]],
|
|
}));
|
|
|
|
const _indexByChar = new Map<string, number>();
|
|
const _charGroupByCategory = new Map<string, string[]>();
|
|
for (let i = 0; i < emojilist.length; i++) {
|
|
const emo = emojilist[i];
|
|
_indexByChar.set(emo.char, i);
|
|
|
|
if (_charGroupByCategory.has(emo.category)) {
|
|
_charGroupByCategory.get(emo.category)?.push(emo.char);
|
|
} else {
|
|
_charGroupByCategory.set(emo.category, [emo.char]);
|
|
}
|
|
}
|
|
|
|
export const emojiCharByCategory = _charGroupByCategory;
|
|
|
|
export function getEmojiName(char: string): string | null {
|
|
const idx = _indexByChar.get(char);
|
|
if (idx == null) {
|
|
return null;
|
|
} else {
|
|
return emojilist[idx].name;
|
|
}
|
|
}
|
|
|
|
export interface CustomEmojiFolderTree {
|
|
value: string;
|
|
category: string;
|
|
children: CustomEmojiFolderTree[];
|
|
}
|