FileFullPreview functionality in file grid view

This commit is contained in:
Peter Papp
2020-08-30 15:33:20 +02:00
parent 2c04376a61
commit 6ba869234e
3 changed files with 21 additions and 7 deletions
@@ -101,9 +101,19 @@
isFile() { isFile() {
return this.data.type !== 'folder' && this.data.type !== 'image' return this.data.type !== 'folder' && this.data.type !== 'image'
}, },
isPdf() {
return this.data.mimetype === 'pdf'
},
isImage() { isImage() {
return this.data.type === 'image' return this.data.type === 'image'
}, },
isVideo() {
return this.data.type === 'video'
},
isAudio() {
let mimetypes = ['mpeg', 'mp3', 'mp4', 'wan', 'flac']
return mimetypes.includes(this.data.mimetype) && this.data.type === 'audio'
},
canEditName() { canEditName() {
return !this.$isMobile() return !this.$isMobile()
&& !this.$isThisLocation(['trash', 'trash-root']) && !this.$isThisLocation(['trash', 'trash-root'])
@@ -166,6 +176,12 @@
} }
} }
if (this.$isMobile()) {
if (this.isImage || this.isVideo || this.isAudio) {
events.$emit('fileFullPreview:show')
}
}
// Load file info detail // Load file info detail
this.$store.commit('GET_FILEINFO_DETAIL', this.data) this.$store.commit('GET_FILEINFO_DETAIL', this.data)
@@ -180,11 +196,11 @@
return return
}, },
goToItem() { goToItem() {
if (this.isImage) { if (this.isImage || this.isVideo || this.isAudio) {
this.$openImageOnNewTab(this.data.file_url) events.$emit('fileFullPreview:show')
} }
if (this.isFile) { if (this.isFile && !this.isPdf && !this.isVideo && !this.isAudio) {
this.$downloadFile( this.$downloadFile(
this.data.file_url, this.data.file_url,
this.data.name + '.' + this.data.mimetype this.data.name + '.' + this.data.mimetype
@@ -137,8 +137,6 @@ export default {
// Load file info detail // Load file info detail
this.$store.commit('GET_FILEINFO_DETAIL', this.data) this.$store.commit('GET_FILEINFO_DETAIL', this.data)
//this.isClicked = true
events.$emit('mobileMenu:show') events.$emit('mobileMenu:show')
}, },
dragEnter() { dragEnter() {
@@ -182,7 +180,6 @@ export default {
}, },
goToItem() { goToItem() {
if (this.isImage || this.isVideo || this.isAudio) { if (this.isImage || this.isVideo || this.isAudio) {
// this.$openImageOnNewTab(this.data.file_url)
events.$emit('fileFullPreview:show') events.$emit('fileFullPreview:show')
} }
@@ -177,10 +177,11 @@ export default {
vertical-align: middle; vertical-align: middle;
cursor: pointer; cursor: pointer;
color: $text; color: $text;
align-self: center;
@include transition(150ms); @include transition(150ms);
&:hover { &:hover {
background: $light_background; background: $light_background;
line { line {
stroke: $theme; stroke: $theme;
} }