1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-23 14:46:40 +09:00

enhance(frontend): 絵文字のフォールバック先を文字じゃなくて画像に (MisskeyIO#757)

This commit is contained in:
まっちゃてぃー。 2024-10-19 23:57:29 +09:00 committed by GitHub
parent 61b758e3dc
commit 65f0138bd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<span v-if="errored">:{{ customEmojiName }}:</span>
<img v-if="errored" src="/client-assets/dummy.png" :alt="alt" :title="alt" decoding="async" :class="[$style.root, { [$style.normal]: normal, [$style.noStyle]: noStyle }]"/>
<img
v-else
:class="[$style.root, { [$style.normal]: normal, [$style.noStyle]: noStyle }]"
@ -19,7 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { computed, inject, ref } from 'vue';
import { computed, inject, ref, watch } from 'vue';
import { getProxiedImageUrl, getStaticImageUrl } from '@/scripts/media-proxy.js';
import { defaultStore } from '@/store.js';
import { customEmojisMap } from '@/custom-emojis.js';
@ -73,6 +73,10 @@ const url = computed(() => {
: proxied;
});
watch(url, (newValue) => {
errored.value = (newValue === undefined);
});
const alt = computed(() => `:${customEmojiName.value}:`);
const errored = ref(url.value == null);