mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-29 22:59:20 +09:00
絵文字ピッカーのカテゴリのフォルダ分けの条件の変更・長いカテゴリ名の表示調整・セクションの背景の追加 (MisskeyIO#204)
* ネストした場合にパネルでどこまでがどのフォルダのものかをわかりやすくした Co-authored-by: meronmks <meronmks.8914@gmail.com>
This commit is contained in:
parent
f66f78d912
commit
c29ec98e3b
@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
<template>
|
<template>
|
||||||
<!-- このコンポーネントの要素のclassは親から利用されるのでむやみに弄らないこと -->
|
<!-- このコンポーネントの要素のclassは親から利用されるのでむやみに弄らないこと -->
|
||||||
<!-- フォルダの中にはカスタム絵文字だけ(Unicode絵文字もこっち) -->
|
<!-- フォルダの中にはカスタム絵文字だけ(Unicode絵文字もこっち) -->
|
||||||
<section v-if="!hasChildSection">
|
<section v-if="!hasChildSection" v-panel style="border-radius: 6px; border-bottom: 0.5px solid var(--divider);">
|
||||||
<header class="_acrylic" @click="shown = !shown">
|
<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-icons"></i>:{{ 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>
|
</header>
|
||||||
@ -25,21 +25,21 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<!-- フォルダの中にはカスタム絵文字やフォルダがある -->
|
<!-- フォルダの中にはカスタム絵文字やフォルダがある -->
|
||||||
<section v-else>
|
<section v-else v-panel style="border-radius: 6px; border-bottom: 0.5px solid var(--divider);">
|
||||||
<header class="_acrylic" @click="shown = !shown">
|
<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"></i>:{{ customEmojiTree.length }} <i class="ti ti-icons"></i>:{{ emojis.length }})
|
<i class="toggle ti-fw" :class="shown ? 'ti ti-chevron-down' : 'ti ti-chevron-up'"></i> <slot></slot> (<i class="ti ti-folder"></i>:{{ customEmojiTree.length }} <i class="ti ti-icons"></i>:{{ emojis.length }})
|
||||||
</header>
|
</header>
|
||||||
<div v-if="shown" style="padding-left: 9px;">
|
<div v-if="shown" style="padding-left: 9px;">
|
||||||
<MkEmojiPickerSection
|
<MkEmojiPickerSection
|
||||||
v-for="child in customEmojiTree"
|
v-for="child in customEmojiTree"
|
||||||
:key="`custom:${child.value}`"
|
:key="`custom:${child.category}`"
|
||||||
:initialShown="initialShown"
|
:initialShown="initialShown"
|
||||||
:emojis="computed(() => customEmojis.filter(e => e.category === child.category).map(e => `:${e.name}:`))"
|
:emojis="computed(() => customEmojis.filter(e => e.category === child.category).map(e => `:${e.name}:`))"
|
||||||
:hasChildSection="child.children.length !== 0"
|
:hasChildSection="child.children.length !== 0"
|
||||||
:customEmojiTree="child.children"
|
:customEmojiTree="child.children"
|
||||||
@chosen="nestedChosen"
|
@chosen="nestedChosen"
|
||||||
>
|
>
|
||||||
{{ child.value || i18n.ts.other }}
|
{{ child.category || i18n.ts.other }}
|
||||||
</MkEmojiPickerSection>
|
</MkEmojiPickerSection>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="shown" class="body">
|
<div v-if="shown" class="body">
|
||||||
|
@ -74,14 +74,14 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
<header class="_acrylic">{{ i18n.ts.customEmojis }}</header>
|
<header class="_acrylic">{{ i18n.ts.customEmojis }}</header>
|
||||||
<XSection
|
<XSection
|
||||||
v-for="child in customEmojiFolderRoot.children"
|
v-for="child in customEmojiFolderRoot.children"
|
||||||
:key="`custom:${child.value}`"
|
:key="`custom:${child.category}`"
|
||||||
:initialShown="false"
|
:initialShown="false"
|
||||||
:emojis="computed(() => customEmojis.filter(e => child.value === '' ? (e.category === 'null' || !e.category) : e.category === child.value).filter(filterAvailable).map(e => `:${e.name}:`))"
|
:emojis="computed(() => customEmojis.filter(e => child.category === '' ? (e.category === 'null' || !e.category) : e.category === child.category).filter(filterAvailable).map(e => `:${e.name}:`))"
|
||||||
:hasChildSection="child.children.length !== 0"
|
:hasChildSection="child.children.length !== 0"
|
||||||
:customEmojiTree="child.children"
|
:customEmojiTree="child.children"
|
||||||
@chosen="chosen"
|
@chosen="chosen"
|
||||||
>
|
>
|
||||||
{{ child.value || i18n.ts.other }}
|
{{ child.category || i18n.ts.other }}
|
||||||
</XSection>
|
</XSection>
|
||||||
</div>
|
</div>
|
||||||
<div v-once class="group">
|
<div v-once class="group">
|
||||||
@ -153,20 +153,19 @@ const searchResultCustom = ref<Misskey.entities.CustomEmoji[]>([]);
|
|||||||
const searchResultUnicode = ref<UnicodeEmojiDef[]>([]);
|
const searchResultUnicode = ref<UnicodeEmojiDef[]>([]);
|
||||||
const tab = ref<'index' | 'custom' | 'unicode' | 'tags'>('index');
|
const tab = ref<'index' | 'custom' | 'unicode' | 'tags'>('index');
|
||||||
|
|
||||||
const customEmojiFolderRoot: CustomEmojiFolderTree = { value: "", category: "", children: [] };
|
const customEmojiFolderRoot: CustomEmojiFolderTree = { category: "", children: [] };
|
||||||
|
|
||||||
function parseAndMergeCategories(input: string, root: CustomEmojiFolderTree): CustomEmojiFolderTree {
|
function parseAndMergeCategories(input: string, root: CustomEmojiFolderTree): CustomEmojiFolderTree {
|
||||||
const parts = (input && input !== 'null' ? input : '').split('/');
|
const parts = (input && input !== 'null' ? input : '').split(' / ');
|
||||||
let currentNode: CustomEmojiFolderTree = root;
|
let currentNode: CustomEmojiFolderTree = root;
|
||||||
|
|
||||||
for (const part of parts) {
|
for (const part of parts) {
|
||||||
const path = currentNode.value ? `${currentNode.value}/${part.trim()}` : part.trim();
|
const path = currentNode.category ? `${currentNode.category} / ${part}` : part;
|
||||||
|
|
||||||
let existingNode = currentNode.children.find((node) => node.value === path);
|
let existingNode = currentNode.children.find((node) => node.category === path);
|
||||||
if (!existingNode) {
|
if (!existingNode) {
|
||||||
const newNode: CustomEmojiFolderTree = {
|
const newNode: CustomEmojiFolderTree = {
|
||||||
value: path,
|
category: path,
|
||||||
category: currentNode.category ? `${currentNode.category}/${part}` : part,
|
|
||||||
children: [],
|
children: [],
|
||||||
};
|
};
|
||||||
currentNode.children.push(newNode);
|
currentNode.children.push(newNode);
|
||||||
@ -616,8 +615,7 @@ defineExpose({
|
|||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
height: 32px;
|
line-height: 28px;
|
||||||
line-height: 32px;
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
@ -45,7 +45,6 @@ export function getEmojiName(char: string): string | null {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface CustomEmojiFolderTree {
|
export interface CustomEmojiFolderTree {
|
||||||
value: string;
|
|
||||||
category: string;
|
category: string;
|
||||||
children: CustomEmojiFolderTree[];
|
children: CustomEmojiFolderTree[];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user