Skip to content

Commit

Permalink
Fix #32 Make photo files linkable
Browse files Browse the repository at this point in the history
  • Loading branch information
safrazik committed Dec 17, 2019
1 parent c07714f commit bd64bf4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
7 changes: 1 addition & 6 deletions src/components/vue-file-preview-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ export default Vue.extend({
if (!this.linkable) {
return false;
}
return (
!!this.fileData.url &&
!this.fileData.isImage() &&
!this.fileData.isPlayableVideo() &&
!this.fileData.isPlayableAudio()
);
return !!this.fileData.url && !this.fileData.isPlayableVideo() && !this.fileData.isPlayableAudio();
},
},
methods: {
Expand Down
11 changes: 9 additions & 2 deletions src/components/vue-file-preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,15 @@
}"
>
<span class="file-preview-overlay"></span>
<span class="thumbnail" style="position: absolute; top: 0; right: 0; bottom: 0; left: 0; overflow: hidden;">
<img v-if="fileData.isImage() || fileData.isPlayableVideo()" class="file-preview-img" :src="fileData.src()" />
<span
class="thumbnail"
style="position: absolute; top: 0; right: 0; bottom: 0; left: 0; overflow: hidden;"
v-if="fileData.isImage() || fileData.isPlayableVideo()"
>
<a v-if="hasLinkableUrl" :href="fileData.url" target="_blank" :title="fileData.name()">
<img class="file-preview-img" :src="fileData.src()" />
</a>
<img v-else class="file-preview-img" :src="fileData.src()" />
</span>
<span class="file-ext">{{ fileData.ext() }}</span>
<span class="file-size">{{ fileData.size() }}</span>
Expand Down

0 comments on commit bd64bf4

Please sign in to comment.