
* ci: swcにしたためtypecheckは別途実施 * 🎨 * Update package.json * マイグレーションが失敗することがあるのを修正 * refactor ci * use tsc for build Windowsだとエラーが出るため * feat: swc build in windows (#10032) * feat: add optional swc * fix: windowsで動かない現象を修正 * fix: fix swc path alias * fix: docker build時に`Host key verification failed`と言われてgitリポジトリからパッケージをインストールできないのでssh -> htpsに変更 * use swc * chore(client): tweak custom emoji size * enhance: make pwa icon maskable (#10033) * 🎨 * feat(server): add @swc/core-android-arm64 to optional (#10034) * feat: add optional swc * fix: windowsで動かない現象を修正 * fix: fix swc path alias * fix: docker build時に`Host key verification failed`と言われてgitリポジトリからパッケージをインストールできないのでssh -> htpsに変更 * feat(server): add @swc/core-android-arm64 to optional * fix: conflict * Update package.json * chore(backend): fix indent * Update CHANGELOG.md * compress png --------- Co-authored-by: CaffeinePower <86540016+cffnpwr@users.noreply.github.com> Co-authored-by: Shogo Sensui <shogosensui@gmail.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp>
66 lines
1.6 KiB
Vue
66 lines
1.6 KiB
Vue
<template>
|
|
<span v-if="errored">:{{ customEmojiName }}:</span>
|
|
<img v-else :class="[$style.root, { [$style.normal]: normal, [$style.noStyle]: noStyle }]" :src="url" :alt="alt" :title="alt" decoding="async" @error="errored = true" @load="errored = false"/>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { computed } from 'vue';
|
|
import { getStaticImageUrl } from '@/scripts/media-proxy';
|
|
import { defaultStore } from '@/store';
|
|
import { customEmojis } from '@/custom-emojis';
|
|
|
|
const props = defineProps<{
|
|
name: string;
|
|
normal?: boolean;
|
|
noStyle?: boolean;
|
|
host?: string | null;
|
|
url?: string;
|
|
}>();
|
|
|
|
const customEmojiName = computed(() => (props.name[0] === ':' ? props.name.substr(1, props.name.length - 2) : props.name).replace('@.', ''));
|
|
|
|
const rawUrl = computed(() => {
|
|
if (props.url) {
|
|
return props.url;
|
|
}
|
|
if (props.host == null && !customEmojiName.value.includes('@')) {
|
|
return customEmojis.value.find(x => x.name === customEmojiName.value)?.url ?? null;
|
|
}
|
|
return props.host ? `/emoji/${customEmojiName.value}@${props.host}.webp` : `/emoji/${customEmojiName.value}.webp`;
|
|
});
|
|
|
|
const url = computed(() =>
|
|
defaultStore.reactiveState.disableShowingAnimatedImages.value && rawUrl.value
|
|
? getStaticImageUrl(rawUrl.value)
|
|
: rawUrl.value,
|
|
);
|
|
|
|
const alt = computed(() => `:${customEmojiName.value}:`);
|
|
let errored = $ref(url.value == null);
|
|
</script>
|
|
|
|
<style lang="scss" module>
|
|
.root {
|
|
height: 2em;
|
|
vertical-align: middle;
|
|
transition: transform 0.2s ease;
|
|
|
|
&:hover {
|
|
transform: scale(1.2);
|
|
}
|
|
}
|
|
|
|
.normal {
|
|
height: 1.25em;
|
|
vertical-align: -0.25em;
|
|
|
|
&:hover {
|
|
transform: none;
|
|
}
|
|
}
|
|
|
|
.noStyle {
|
|
height: auto !important;
|
|
}
|
|
</style>
|