client: fix alt text for non-image files

Reviewed-on: FoundKeyGang/FoundKey#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, placeholder: i18n.ts.inputNewDescription,
default: props.file.comment ?? '', default: props.file.comment ?? '',
}, },
image: props.file, file: props.file,
}, { }, {
done: result => { done: result => {
if (!result || result.canceled) return; if (!result || result.canceled) return;

View file

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

View file

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