summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkEmojiPicker.section.vue
diff options
context:
space:
mode:
authormeron <meronmks.8914@gmail.com>2023-12-02 15:26:46 +0900
committerGitHub <noreply@github.com>2023-12-02 15:26:46 +0900
commitc190b720d3d4f3aa93a0556f63be4b09e241108c (patch)
tree2fe55e636e0254cd7bbe330b43c5315b3fd54803 /packages/frontend/src/components/MkEmojiPicker.section.vue
parentchore: remove unimplemented excludeNsfw (#12520) (diff)
downloadmisskey-c190b720d3d4f3aa93a0556f63be4b09e241108c.tar.gz
misskey-c190b720d3d4f3aa93a0556f63be4b09e241108c.tar.bz2
misskey-c190b720d3d4f3aa93a0556f63be4b09e241108c.zip
feat(frontend): 絵文字ピッカーのカテゴリを多階層フォルダで分類できるように (#12132)
* 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>
Diffstat (limited to 'packages/frontend/src/components/MkEmojiPicker.section.vue')
-rw-r--r--packages/frontend/src/components/MkEmojiPicker.section.vue47
1 files changed, 44 insertions, 3 deletions
diff --git a/packages/frontend/src/components/MkEmojiPicker.section.vue b/packages/frontend/src/components/MkEmojiPicker.section.vue
index 08297ea5ba..35de9bbb5e 100644
--- a/packages/frontend/src/components/MkEmojiPicker.section.vue
+++ b/packages/frontend/src/components/MkEmojiPicker.section.vue
@@ -5,9 +5,10 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<!-- このコンポーネントの要素のclassは親から利用されるのでむやみに弄らないこと -->
-<section>
+<!-- フォルダの中にはカスタム絵文字だけ(Unicode絵文字もこっち) -->
+<section v-if="!hasChildSection" v-panel style="border-radius: 6px; border-bottom: 0.5px solid var(--divider);">
<header class="_acrylic" @click="shown = !shown">
- <i class="toggle ti-fw" :class="shown ? 'ti ti-chevron-down' : 'ti ti-chevron-up'"></i> <slot></slot> ({{ emojis.length }})
+ <i class="toggle ti-fw" :class="shown ? 'ti ti-chevron-down' : 'ti ti-chevron-up'"></i> <slot></slot> (<i class="ti ti-icons"></i>:{{ emojis.length }})
</header>
<div v-if="shown" class="body">
<button
@@ -23,15 +24,52 @@ SPDX-License-Identifier: AGPL-3.0-only
</button>
</div>
</section>
+<!-- フォルダの中にはカスタム絵文字やフォルダがある -->
+<section v-else v-panel style="border-radius: 6px; border-bottom: 0.5px solid var(--divider);">
+ <header class="_acrylic" @click="shown = !shown">
+ <i class="toggle ti-fw" :class="shown ? 'ti ti-chevron-down' : 'ti ti-chevron-up'"></i> <slot></slot> (<i class="ti ti-folder ti-fw"></i>:{{ customEmojiTree.length }} <i class="ti ti-icons ti-fw"></i>:{{ emojis.length }})
+ </header>
+ <div v-if="shown" style="padding-left: 9px;">
+ <MkEmojiPickerSection
+ v-for="child in customEmojiTree"
+ :key="`custom:${child.value}`"
+ :initialShown="initialShown"
+ :emojis="computed(() => customEmojis.filter(e => e.category === child.category).map(e => `:${e.name}:`))"
+ :hasChildSection="child.children.length !== 0"
+ :customEmojiTree="child.children"
+ @chosen="nestedChosen"
+ >
+ {{ child.value || i18n.ts.other }}
+ </MkEmojiPickerSection>
+ </div>
+ <div v-if="shown" class="body">
+ <button
+ v-for="emoji in emojis"
+ :key="emoji"
+ :data-emoji="emoji"
+ class="_button item"
+ @pointerenter="computeButtonTitle"
+ @click="emit('chosen', emoji, $event)"
+ >
+ <MkCustomEmoji v-if="emoji[0] === ':'" class="emoji" :name="emoji" :normal="true"/>
+ <MkEmoji v-else class="emoji" :emoji="emoji" :normal="true"/>
+ </button>
+ </div>
+</section>
</template>
<script lang="ts" setup>
import { ref, computed, Ref } from 'vue';
-import { getEmojiName } from '@/scripts/emojilist.js';
+import { CustomEmojiFolderTree, getEmojiName } from '@/scripts/emojilist.js';
+import { i18n } from '../i18n.js';
+import { customEmojis } from '@/custom-emojis.js';
+import MkEmojiPickerSection from '@/components/MkEmojiPicker.section.vue';
const props = defineProps<{
emojis: string[] | Ref<string[]>;
initialShown?: boolean;
+ hasChildSection?: boolean;
+ customEmojiTree?: CustomEmojiFolderTree[];
}>();
const emit = defineEmits<{
@@ -49,4 +87,7 @@ function computeButtonTitle(ev: MouseEvent): void {
elm.title = getEmojiName(emoji) ?? emoji;
}
+function nestedChosen(emoji: any, ev?: MouseEvent) {
+ emit('chosen', emoji, ev);
+}
</script>