Add support for PDF file captions
This commit is contained in:
parent
5e1223fc01
commit
6f05d14877
6 changed files with 43 additions and 11 deletions
|
|
@ -1,13 +1,13 @@
|
|||
<template>
|
||||
<div class="swipeable-thumbnails-view">
|
||||
<v-responsive :aspect-ratio="16 / 9" class="ma-0 pa-0">
|
||||
<v-carousel height="100%" hide-delimiters show-arrows-on-hover v-model="currentIndex">
|
||||
<v-responsive :aspect-ratio="aspectRatio" class="ma-0 pa-0">
|
||||
<v-carousel height="100%" hide-delimiters :show-arrows="items.length > 1" :show-arrows-on-hover="items.length > 1" v-model="currentIndex">
|
||||
<v-carousel-item v-for="(item,index) in items" :key="item.event.getId()">
|
||||
<ThumbnailView :item="items[index]" :previewOnly="true" />
|
||||
<ThumbnailView :item="items[index]" :previewOnly="true" v-on:itemclick="itemClicked" />
|
||||
</v-carousel-item>
|
||||
</v-carousel>
|
||||
</v-responsive>
|
||||
<div class="indicator-container">
|
||||
<div class="indicator-container" v-show="items.length > 1">
|
||||
<div v-for="(item,index) in items" :key="index" :class="{'indicator': true, 'current': index == currentIndex}" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
<script>
|
||||
import messageMixin from "../../messages/messageMixin";
|
||||
import ThumbnailView from '../../file_mode/ThumbnailView.vue';
|
||||
import util from "../../../plugins/utils";
|
||||
|
||||
export default {
|
||||
mixins: [messageMixin],
|
||||
|
|
@ -33,6 +34,21 @@ export default {
|
|||
currentIndex: 0,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
aspectRatio() {
|
||||
return this.items.some((item) =>['m.video','m.image'].includes(item.event.getContent().msgtype)) ? 16/9 : undefined;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
itemClicked() {
|
||||
if (this.items.length > 0 && this.currentIndex < this.items.length) {
|
||||
const item = this.items[this.currentIndex];
|
||||
if (util.isFileTypePDF(item.event)) {
|
||||
this.$emit("download", {event: item.event});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue