diff --git a/locales/en-US.yml b/locales/en-US.yml
index 5f588efd443a..74961a5bc44e 100644
--- a/locales/en-US.yml
+++ b/locales/en-US.yml
@@ -311,6 +311,7 @@ folderName: "Folder name"
createFolder: "Create a folder"
renameFolder: "Rename this folder"
deleteFolder: "Delete this folder"
+Folder: "Folder"
addFile: "Add a file"
emptyDrive: "Your Drive is empty"
emptyFolder: "This folder is empty"
diff --git a/locales/index.d.ts b/locales/index.d.ts
index 363032eaa258..bc7b9e8ef25c 100644
--- a/locales/index.d.ts
+++ b/locales/index.d.ts
@@ -314,6 +314,7 @@ export interface Locale {
"createFolder": string;
"renameFolder": string;
"deleteFolder": string;
+ "Folder": string;
"addFile": string;
"emptyDrive": string;
"emptyFolder": string;
diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index f1b57f8bdea4..9568ba12d7e0 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -311,6 +311,7 @@ folderName: "フォルダー名"
createFolder: "フォルダーを作成"
renameFolder: "フォルダー名を変更"
deleteFolder: "フォルダーを削除"
+Folder: "フォルダー"
addFile: "ファイルを追加"
emptyDrive: "ドライブは空です"
emptyFolder: "フォルダーは空です"
diff --git a/packages/frontend/src/components/MkEmojiPicker.section.vue b/packages/frontend/src/components/MkEmojiPicker.section.vue
index 08297ea5baef..9de20608c3af 100644
--- a/packages/frontend/src/components/MkEmojiPicker.section.vue
+++ b/packages/frontend/src/components/MkEmojiPicker.section.vue
@@ -5,7 +5,8 @@ SPDX-License-Identifier: AGPL-3.0-only
-
+
+
@@ -23,15 +24,54 @@ SPDX-License-Identifier: AGPL-3.0-only
+
+
+
+ ({{ i18n.ts.Folder }} : {{customEmojiTree.length}} {{ i18n.ts.customEmojis}} : {{emojis.length}})
+
+
+
+
+
+
+
+ {{ child.value }}
+
+
+
diff --git a/packages/frontend/src/components/MkEmojiPicker.vue b/packages/frontend/src/components/MkEmojiPicker.vue
index 7eff63748234..1153c9b31bc3 100644
--- a/packages/frontend/src/components/MkEmojiPicker.vue
+++ b/packages/frontend/src/components/MkEmojiPicker.vue
@@ -73,18 +73,20 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts.customEmojis }}
- {{ category || i18n.ts.other }}
+ {{ child.value }}
- {{ category }}
+ {{ category }}
@@ -100,7 +102,14 @@ SPDX-License-Identifier: AGPL-3.0-only
import { ref, shallowRef, computed, watch, onMounted } from 'vue';
import * as Misskey from 'misskey-js';
import XSection from '@/components/MkEmojiPicker.section.vue';
-import { emojilist, emojiCharByCategory, UnicodeEmojiDef, unicodeEmojiCategories as categories, getEmojiName } from '@/scripts/emojilist.js';
+import {
+ emojilist,
+ emojiCharByCategory,
+ UnicodeEmojiDef,
+ unicodeEmojiCategories as categories,
+ getEmojiName,
+ CustomEmojiFolderTree
+} from '@/scripts/emojilist.js';
import MkRippleEffect from '@/components/MkRippleEffect.vue';
import * as os from '@/os.js';
import { isTouchUsing } from '@/scripts/touch.js';
@@ -144,6 +153,43 @@ const searchResultCustom = ref([]);
const searchResultUnicode = ref([]);
const tab = ref<'index' | 'custom' | 'unicode' | 'tags'>('index');
+
+const customEmojiFolderRoot: CustomEmojiFolderTree = { value: "", category: "", children: [] };
+
+function parseAndMergeCategories(input: string, root: CustomEmojiFolderTree): CustomEmojiFolderTree {
+ const parts = input.split('/');
+ var category = ""
+ let currentNode: CustomEmojiFolderTree = root;
+
+ for (const part of parts) {
+ if (part) {
+ category += `/${part}`;
+ category = category.replace(/^\//, '');
+ let existingNode = currentNode.children.find((node) => node.value === part);
+
+ if (!existingNode) {
+ const newNode: CustomEmojiFolderTree = { value: part, category, children: [] };
+ currentNode.children.push(newNode);
+ existingNode = newNode;
+ }
+
+ currentNode = existingNode;
+ }
+ }
+
+ return currentNode;
+}
+
+customEmojiCategories.value.forEach(e => {
+ if (e !== null){
+ parseAndMergeCategories(e, customEmojiFolderRoot);
+ }
+});
+
+parseAndMergeCategories(i18n.ts.other, customEmojiFolderRoot);
+
+console.log(customEmojiFolderRoot)
+
watch(q, () => {
if (emojisEl.value) emojisEl.value.scrollTop = 0;
diff --git a/packages/frontend/src/scripts/emojilist.ts b/packages/frontend/src/scripts/emojilist.ts
index 4159da84c883..8885bf4b7f5f 100644
--- a/packages/frontend/src/scripts/emojilist.ts
+++ b/packages/frontend/src/scripts/emojilist.ts
@@ -43,3 +43,9 @@ export function getEmojiName(char: string): string | null {
return emojilist[idx].name;
}
}
+
+export interface CustomEmojiFolderTree {
+ value: string;
+ category: string;
+ children: CustomEmojiFolderTree[];
+}