This commit is contained in:
syuilo 2024-10-31 13:47:30 +09:00
parent 17d9aca5a7
commit ceb60d61b0

View file

@ -10,7 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:initialHeight="500" :initialHeight="500"
:canResize="true" :canResize="true"
@close="windowEl.close()" @close="windowEl.close()"
@closed="$emit('closed')" @closed="emit('closed')"
> >
<template v-if="emoji" #header>:{{ emoji.name }}:</template> <template v-if="emoji" #header>:{{ emoji.name }}:</template>
<template v-else #header>New emoji</template> <template v-else #header>New emoji</template>
@ -98,6 +98,11 @@ const props = defineProps<{
emoji?: Misskey.entities.EmojiDetailed, emoji?: Misskey.entities.EmojiDetailed,
}>(); }>();
const emit = defineEmits<{
(ev: 'done', v: { deleted?: boolean; updated?: Misskey.entities.AdminEmojiUpdateRequest; created?: Misskey.entities.AdminEmojiUpdateRequest }): void,
(ev: 'closed'): void
}>();
const windowEl = ref<InstanceType<typeof MkWindow> | null>(null); const windowEl = ref<InstanceType<typeof MkWindow> | null>(null);
const name = ref<string>(props.emoji ? props.emoji.name : ''); const name = ref<string>(props.emoji ? props.emoji.name : '');
const category = ref<string>(props.emoji?.category ? props.emoji.category : ''); const category = ref<string>(props.emoji?.category ? props.emoji.category : '');
@ -115,11 +120,6 @@ watch(roleIdsThatCanBeUsedThisEmojiAsReaction, async () => {
const imgUrl = computed(() => file.value ? file.value.url : props.emoji ? `/emoji/${props.emoji.name}.webp` : null); const imgUrl = computed(() => file.value ? file.value.url : props.emoji ? `/emoji/${props.emoji.name}.webp` : null);
const emit = defineEmits<{
(ev: 'done', v: { deleted?: boolean; updated?: Misskey.entities.AdminEmojiUpdateRequest; created?: Misskey.entities.AdminEmojiUpdateRequest }): void,
(ev: 'closed'): void
}>();
async function changeImage(ev: Event) { async function changeImage(ev: Event) {
file.value = await selectFile(ev.currentTarget ?? ev.target, null); file.value = await selectFile(ev.currentTarget ?? ev.target, null);
const candidate = file.value.name.replace(/\.(.+)$/, ''); const candidate = file.value.name.replace(/\.(.+)$/, '');