fix: placeholder for broken image urls and avoid overlowing emoji alt text (#327)
parent
e75cc9edf2
commit
8f32b1ce22
|
@ -6,17 +6,19 @@ defineProps<{
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const loaded = $ref(false)
|
const loaded = $ref(false)
|
||||||
|
const error = $ref(false)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<img
|
<img
|
||||||
:key="account.avatar"
|
:key="account.avatar"
|
||||||
:src="account.avatar"
|
:src="error ? 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' : account.avatar"
|
||||||
:alt="$t('account.avatar_description', [account.username])"
|
:alt="$t('account.avatar_description', [account.username])"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
rounded-full
|
rounded-full
|
||||||
:class="loaded ? 'bg-gray' : 'bg-gray:10'"
|
:class="loaded ? 'bg-gray' : 'bg-gray:10'"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
@load="loaded = true"
|
@load="loaded = true"
|
||||||
|
@error="error = true"
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -43,6 +43,7 @@ body {
|
||||||
|
|
||||||
.custom-emoji {
|
.custom-emoji {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
overflow: hidden;
|
||||||
max-height: 1.3em;
|
max-height: 1.3em;
|
||||||
max-width: 1.3em;
|
max-width: 1.3em;
|
||||||
vertical-align: text-bottom;
|
vertical-align: text-bottom;
|
||||||
|
|
Loading…
Reference in New Issue