download pdf file fixes

This commit is contained in:
10G Meow 2022-02-13 11:31:41 +02:00
parent 66f18a7df2
commit 339452e607
3 changed files with 11 additions and 7 deletions

View file

@ -1526,10 +1526,14 @@ export default {
const link = document.createElement("a");
link.href = url;
link.target = "_blank";
link.download =
event.getContent().body || this.$t("fallbacks.download_name");
link.download = event.getContent().body || this.$t("fallbacks.download_name");
document.body.appendChild(link);
link.click();
URL.revokeObjectURL(url);
setTimeout(function(){
document.body.removeChild(link);
URL.revokeObjectURL(url);
}, 200)
})
.catch((err) => {
console.log("Failed to fetch attachment: ", err);

View file

@ -11,14 +11,14 @@
/>
</div>
<div class="message">
<span>{{ $t('file_prefix') }}</span>
<span>{{ $t('message.file_prefix') }}</span>
<span
style="cursor: pointer"
@click.stop="$emit('download')"
v-html="linkify($sanitize(messageText))"
/>
<span class="edit-marker" v-if="event.replacingEventId()"
>{{ $t('edited') }}</span
>{{ $t('message.edited') }}</span
>
</div>
</div>

View file

@ -12,14 +12,14 @@
</div>
<div class="message">
<span>File: </span>
<span>{{ $t('message.file_prefix') }}</span>
<span
style="cursor: pointer"
@click.stop="$emit('download')"
v-html="linkify($sanitize(messageText))"
/>
<span class="edit-marker" v-if="event.replacingEventId()"
>{{ $t('edited') }}</span
>{{ $t('message.edited') }}</span
>
</div>
</div>