client: fix alt text for non-image files
All checks were successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/test Pipeline was successful

Reviewed-on: #106
Changelog: Fixed
This commit is contained in:
Norm 2022-09-03 23:37:28 +00:00
commit 500c0be179
3 changed files with 15 additions and 8 deletions

View file

@ -141,7 +141,7 @@ function describe(): void {
placeholder: i18n.ts.inputNewDescription,
default: props.file.comment ?? '',
},
image: props.file,
file: props.file,
}, {
done: result => {
if (!result || result.canceled) return;

View file

@ -15,12 +15,19 @@
</div>
</div>
<div class="hdrwpsaf fullwidth">
<header>{{ image.name }}</header>
<img :src="image.url" :alt="image.comment" :title="image.comment" @click="modal.close()"/>
<header>{{ file.name }}</header>
<img v-if="file.type.startsWidth('image/')" :src="file.url" @click="modal.close()"/>
<video v-else-if="file.type.startsWidth('video/')" controls>
<source :src="file.url" :type="file.type">
</video>
<audio v-else-if="file.type.startsWidth('audio/')" controls>
<source :src="file.url" :type="file.type">
</audio>
<a v-else :href="file.url">{{ file.url }}</a>
<footer>
<span>{{ image.type }}</span>
<span>{{ bytes(image.size) }}</span>
<span v-if="image.properties && image.properties.width">{{ number(image.properties.width) }}px × {{ number(image.properties.height) }}px</span>
<span>{{ file.type }}</span>
<span>{{ bytes(file.size) }}</span>
<span v-if="file.properties?.width">{{ number(file.properties.width) }}px × {{ number(file.properties.height) }}px</span>
</footer>
</div>
</div>
@ -43,7 +50,7 @@ type Input = {
};
const props = withDefaults(defineProps<{
image: misskey.entities.DriveFile;
file: misskey.entities.DriveFile;
title?: string;
input: Input;
showOkButton: boolean;

View file

@ -84,7 +84,7 @@ async function describe(file: DriveFile): Promise<void> {
placeholder: i18n.ts.inputNewDescription,
default: file.comment ?? '',
},
image: file,
file,
}, {
done: result => {
if (!result || result.canceled) return;