mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-19 16:32:15 +00:00
added prettier
This commit is contained in:
@@ -1,71 +1,63 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="isFullPreview"
|
||||
class="file-preview z-40"
|
||||
ref="filePreview"
|
||||
tabindex="-1"
|
||||
@keydown.esc="closeFilePreview"
|
||||
@keydown.right="next"
|
||||
@keydown.left="prev"
|
||||
>
|
||||
<FilePreviewToolbar />
|
||||
<FilePreviewMedia />
|
||||
</div>
|
||||
<div v-if="isFullPreview" class="file-preview z-40" ref="filePreview" tabindex="-1" @keydown.esc="closeFilePreview" @keydown.right="next" @keydown.left="prev">
|
||||
<FilePreviewToolbar />
|
||||
<FilePreviewMedia />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FilePreviewToolbar from "./FilePreviewToolbar";
|
||||
import FilePreviewMedia from "./FilePreviewMedia";
|
||||
import {events} from "../../bus";
|
||||
import FilePreviewToolbar from './FilePreviewToolbar'
|
||||
import FilePreviewMedia from './FilePreviewMedia'
|
||||
import { events } from '../../bus'
|
||||
|
||||
export default {
|
||||
name: 'FilePreview',
|
||||
components: {
|
||||
FilePreviewToolbar,
|
||||
FilePreviewMedia,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isFullPreview: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
closeFilePreview() {
|
||||
this.isFullPreview = false
|
||||
this.$store.commit('FAST_PREVIEW_CLEAR')
|
||||
},
|
||||
next() {
|
||||
events.$emit('file-preview:next')
|
||||
},
|
||||
prev() {
|
||||
events.$emit('file-preview:prev')
|
||||
}
|
||||
},
|
||||
updated() {
|
||||
if (this.isFullPreview) {
|
||||
this.$refs.filePreview.focus()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
events.$on('file-preview:show', () => this.isFullPreview = true)
|
||||
events.$on('file-preview:hide', () => this.closeFilePreview())
|
||||
export default {
|
||||
name: 'FilePreview',
|
||||
components: {
|
||||
FilePreviewToolbar,
|
||||
FilePreviewMedia,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isFullPreview: false,
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
closeFilePreview() {
|
||||
this.isFullPreview = false
|
||||
this.$store.commit('FAST_PREVIEW_CLEAR')
|
||||
},
|
||||
next() {
|
||||
events.$emit('file-preview:next')
|
||||
},
|
||||
prev() {
|
||||
events.$emit('file-preview:prev')
|
||||
},
|
||||
},
|
||||
updated() {
|
||||
if (this.isFullPreview) {
|
||||
this.$refs.filePreview.focus()
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
events.$on('file-preview:show', () => (this.isFullPreview = true))
|
||||
events.$on('file-preview:hide', () => this.closeFilePreview())
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../../../sass/vuefilemanager/variables';
|
||||
@import '../../../sass/vuefilemanager/variables';
|
||||
|
||||
.file-preview {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.dark {
|
||||
.file-preview {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
background-color: white;
|
||||
background-color: $dark_mode_background;
|
||||
}
|
||||
|
||||
.dark {
|
||||
.file-preview {
|
||||
background-color: $dark_mode_background;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<div v-if="currentFile" class="file-preview-wrapper">
|
||||
|
||||
<div v-if="currentFile" class="file-preview-wrapper">
|
||||
<!--Arrow navigation-->
|
||||
<div v-if="files.length > 1" class="navigation-arrows">
|
||||
<div @click.prevent="prev" class="prev">
|
||||
@@ -13,31 +12,30 @@
|
||||
</div>
|
||||
|
||||
<!--File preview-->
|
||||
<div class="file-wrapper-preview">
|
||||
|
||||
<div class="file-wrapper-preview">
|
||||
<!--Show PDF-->
|
||||
<PdfFile v-if="isPDF" :file="currentFile"/>
|
||||
<PdfFile v-if="isPDF" :file="currentFile" />
|
||||
|
||||
<!--Show Audio, Video and Image-->
|
||||
<div v-if="isAudio || isImage || isVideo" class="file-wrapper">
|
||||
<Audio v-if="isAudio" :file="currentFile"/>
|
||||
<Video v-if="isVideo" :file="currentFile"/>
|
||||
<ImageFile v-if="isImage" :file="currentFile"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Audio v-if="isAudio" :file="currentFile" />
|
||||
<Video v-if="isVideo" :file="currentFile" />
|
||||
<ImageFile v-if="isImage" :file="currentFile" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {ChevronLeftIcon, ChevronRightIcon} from 'vue-feather-icons'
|
||||
import ToolbarButton from "../FilesView/ToolbarButton";
|
||||
import ImageFile from "./Media/ImageFile";
|
||||
import PdfFile from "./Media/PdfFile";
|
||||
import Audio from "./Media/Audio";
|
||||
import Video from "./Media/Video";
|
||||
import Spinner from "../FilesView/Spinner";
|
||||
import {mapGetters} from 'vuex'
|
||||
import {events} from "../../bus";
|
||||
import { ChevronLeftIcon, ChevronRightIcon } from 'vue-feather-icons'
|
||||
import ToolbarButton from '../FilesView/ToolbarButton'
|
||||
import ImageFile from './Media/ImageFile'
|
||||
import PdfFile from './Media/PdfFile'
|
||||
import Audio from './Media/Audio'
|
||||
import Video from './Media/Video'
|
||||
import Spinner from '../FilesView/Spinner'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { events } from '../../bus'
|
||||
|
||||
export default {
|
||||
name: 'FilePreviewMedia',
|
||||
@@ -45,22 +43,16 @@ export default {
|
||||
ChevronRightIcon,
|
||||
ChevronLeftIcon,
|
||||
ToolbarButton,
|
||||
ImageFile,
|
||||
PdfFile,
|
||||
ImageFile,
|
||||
PdfFile,
|
||||
Spinner,
|
||||
Audio,
|
||||
Video,
|
||||
Audio,
|
||||
Video,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'fastPreview',
|
||||
'clipboard',
|
||||
'entries',
|
||||
]),
|
||||
...mapGetters(['fastPreview', 'clipboard', 'entries']),
|
||||
currentFile() {
|
||||
return this.fastPreview
|
||||
? this.fastPreview
|
||||
: this.files[Math.abs(this.currentIndex) % this.files.length]
|
||||
return this.fastPreview ? this.fastPreview : this.files[Math.abs(this.currentIndex) % this.files.length]
|
||||
},
|
||||
isPDF() {
|
||||
return this.currentFile.data.attributes.mimetype === 'pdf'
|
||||
@@ -73,7 +65,7 @@ export default {
|
||||
},
|
||||
isImage() {
|
||||
return this.currentFile.data.type === 'image'
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -83,8 +75,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
files() {
|
||||
if (this.files.length === 0)
|
||||
events.$emit('file-preview-wrapper:hide')
|
||||
if (this.files.length === 0) events.$emit('file-preview-wrapper:hide')
|
||||
},
|
||||
currentFile() {
|
||||
if (this.clipboard[0]) {
|
||||
@@ -111,17 +102,11 @@ export default {
|
||||
getFilesForView() {
|
||||
let requestedFile = this.clipboard[0]
|
||||
|
||||
this.entries.map(element => {
|
||||
|
||||
this.entries.map((element) => {
|
||||
if (requestedFile.data.attributes.mimetype === 'pdf') {
|
||||
|
||||
if (element.data.attributes.mimetype === 'pdf')
|
||||
this.files.push(element)
|
||||
|
||||
if (element.data.attributes.mimetype === 'pdf') this.files.push(element)
|
||||
} else {
|
||||
|
||||
if (element.data.type === requestedFile.data.type)
|
||||
this.files.push(element)
|
||||
if (element.data.type === requestedFile.data.type) this.files.push(element)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -131,31 +116,31 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
next() {
|
||||
if (!this.files.length > 1) return
|
||||
next() {
|
||||
if (!this.files.length > 1) return
|
||||
|
||||
this.currentIndex += 1
|
||||
this.currentIndex += 1
|
||||
|
||||
if (this.currentIndex > this.files.length - 1) {
|
||||
this.currentIndex = 0
|
||||
}
|
||||
},
|
||||
prev() {
|
||||
if (!this.files.length > 1) return
|
||||
if (this.currentIndex > this.files.length - 1) {
|
||||
this.currentIndex = 0
|
||||
}
|
||||
},
|
||||
prev() {
|
||||
if (!this.files.length > 1) return
|
||||
|
||||
this.currentIndex -= 1
|
||||
this.currentIndex -= 1
|
||||
|
||||
if (this.currentIndex < 0) {
|
||||
this.currentIndex = this.files.length - 1
|
||||
}
|
||||
}
|
||||
if (this.currentIndex < 0) {
|
||||
this.currentIndex = this.files.length - 1
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {
|
||||
events.$on('file-preview:next', () => this.next())
|
||||
events.$on('file-preview:next', () => this.next())
|
||||
events.$on('file-preview:prev', () => this.prev())
|
||||
|
||||
this.getFilesForView()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -164,8 +149,8 @@ export default {
|
||||
@import '../../../sass/vuefilemanager/mixins';
|
||||
|
||||
.navigation-arrows {
|
||||
|
||||
.prev, .next {
|
||||
.prev,
|
||||
.next {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 45%;
|
||||
@@ -234,17 +219,15 @@ export default {
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 960px) {
|
||||
|
||||
.file-preview-wrapper {
|
||||
top: 53px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.dark {
|
||||
|
||||
.navigation-arrows {
|
||||
.prev, .next {
|
||||
.prev,
|
||||
.next {
|
||||
color: $light-text;
|
||||
filter: drop-shadow(0px 1px 0 rgba(17, 19, 20, 1));
|
||||
}
|
||||
@@ -260,4 +243,4 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -1,173 +1,166 @@
|
||||
<template>
|
||||
<div class="navigation-panel" v-if="currentFile">
|
||||
<div class="name-wrapper">
|
||||
<div class="navigation-panel" v-if="currentFile">
|
||||
<div class="name-wrapper">
|
||||
<!--Close icon-->
|
||||
<span @click="closeFullPreview" class="-m-3 p-3">
|
||||
<x-icon size="17" class="icon-close hover-text-theme" />
|
||||
</span>
|
||||
|
||||
<!--Close icon-->
|
||||
<span @click="closeFullPreview" class="p-3 -m-3">
|
||||
<x-icon size="17" class="icon-close hover-text-theme" />
|
||||
</span>
|
||||
<!--Item name-->
|
||||
<div class="name-count-wrapper">
|
||||
<p class="title">{{ currentFile.data.attributes.name }}</p>
|
||||
<span v-if="!fastPreview" class="file-count"> ({{ showingImageIndex + ' ' + $t('pronouns.of') + ' ' + files.length }}) </span>
|
||||
</div>
|
||||
|
||||
<!--Item name-->
|
||||
<div class="name-count-wrapper">
|
||||
<p class="title">{{ currentFile.data.attributes.name }}</p>
|
||||
<span v-if="! fastPreview" class="file-count"> ({{ showingImageIndex + ' ' + $t('pronouns.of') + ' ' + files.length }}) </span>
|
||||
</div>
|
||||
<!--Context menu handler-->
|
||||
<PopoverWrapper>
|
||||
<!--Icon-->
|
||||
<span @click.stop="showItemContextMenu" class="-m-3 p-3">
|
||||
<div class="inline-block rounded-md bg-light-background py-0.5 px-1.5 align-middle transition-all duration-200 dark:bg-dark-foreground lg:bg-transparent">
|
||||
<more-horizontal-icon size="14" />
|
||||
</div>
|
||||
</span>
|
||||
|
||||
<!--Context menu handler-->
|
||||
<PopoverWrapper>
|
||||
<!--Desktop context menu-->
|
||||
<PopoverItem name="file-preview-contextmenu" side="right">
|
||||
<OptionGroup>
|
||||
<Option @click.native="$renameFileOrFolder(currentFile)" :title="$t('context_menu.rename')" icon="rename" />
|
||||
<Option @click.native="$moveFileOrFolder(currentFile)" :title="$t('context_menu.move')" icon="move-item" />
|
||||
<Option @click.native="$shareFileOrFolder(currentFile)" :title="sharingTitle" icon="share" v-if="$checkPermission('master')" />
|
||||
<Option @click.native="$deleteFileOrFolder(currentFile)" :title="$t('context_menu.delete')" icon="trash" class="menu-option" />
|
||||
</OptionGroup>
|
||||
<OptionGroup>
|
||||
<Option @click.native="downloadItem" :title="$t('context_menu.download')" icon="download" />
|
||||
</OptionGroup>
|
||||
</PopoverItem>
|
||||
</PopoverWrapper>
|
||||
</div>
|
||||
|
||||
<!--Icon-->
|
||||
<span @click.stop="showItemContextMenu" class="p-3 -m-3">
|
||||
<div class="py-0.5 px-1.5 align-middle inline-block rounded-md lg:bg-transparent dark:bg-dark-foreground bg-light-background transition-all duration-200">
|
||||
<more-horizontal-icon size="14" />
|
||||
</div>
|
||||
</span>
|
||||
<!--Item metadata-->
|
||||
<div class="created-at-wrapper">
|
||||
<p>
|
||||
{{ currentFile.data.attributes.filesize }},
|
||||
{{ currentFile.data.attributes.created_at }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!--Desktop context menu-->
|
||||
<PopoverItem name="file-preview-contextmenu" side="right">
|
||||
<OptionGroup>
|
||||
<Option @click.native="$renameFileOrFolder(currentFile)" :title="$t('context_menu.rename')" icon="rename" />
|
||||
<Option @click.native="$moveFileOrFolder(currentFile)" :title="$t('context_menu.move')" icon="move-item" />
|
||||
<Option @click.native="$shareFileOrFolder(currentFile)" :title="sharingTitle" icon="share" v-if="$checkPermission('master')" />
|
||||
<Option @click.native="$deleteFileOrFolder(currentFile)" :title="$t('context_menu.delete')" icon="trash" class="menu-option" />
|
||||
</OptionGroup>
|
||||
<OptionGroup>
|
||||
<Option @click.native="downloadItem" :title="$t('context_menu.download')" icon="download" />
|
||||
</OptionGroup>
|
||||
</PopoverItem>
|
||||
</PopoverWrapper>
|
||||
</div>
|
||||
|
||||
<!--Item metadata-->
|
||||
<div class="created-at-wrapper">
|
||||
<p>{{ currentFile.data.attributes.filesize }}, {{ currentFile.data.attributes.created_at }}</p>
|
||||
</div>
|
||||
|
||||
<!--Icon actions-->
|
||||
<div class="navigation-icons">
|
||||
<div v-if="isPdf" class="navigation-tool-wrapper">
|
||||
<ToolbarButton @click.native="decreaseSizeOfPDF" source="zoom-out" :action="$t('pdf_zoom_out')" />
|
||||
<ToolbarButton @click.native="increaseSizeOfPDF" source="zoom-in" :action="$t('pdf_zoom_in')" />
|
||||
</div>
|
||||
<div class="navigation-tool-wrapper">
|
||||
<ToolbarButton @click.native="downloadItem" class="mobile-hide" source="download" :action="$t('actions.download')" />
|
||||
<ToolbarButton v-if="canShareItem" @click.native="$shareFileOrFolder(currentFile)" class="mobile-hide" :class="{ 'is-inactive': !canShareItem }" source="share" :action="$t('actions.share')" />
|
||||
<ToolbarButton v-if="isImage" @click.native="printMethod()" source="print" :action="$t('actions.print')" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--Icon actions-->
|
||||
<div class="navigation-icons">
|
||||
<div v-if="isPdf" class="navigation-tool-wrapper">
|
||||
<ToolbarButton @click.native="decreaseSizeOfPDF" source="zoom-out" :action="$t('pdf_zoom_out')" />
|
||||
<ToolbarButton @click.native="increaseSizeOfPDF" source="zoom-in" :action="$t('pdf_zoom_in')" />
|
||||
</div>
|
||||
<div class="navigation-tool-wrapper">
|
||||
<ToolbarButton @click.native="downloadItem" class="mobile-hide" source="download" :action="$t('actions.download')" />
|
||||
<ToolbarButton
|
||||
v-if="canShareItem"
|
||||
@click.native="$shareFileOrFolder(currentFile)"
|
||||
class="mobile-hide"
|
||||
:class="{ 'is-inactive': !canShareItem }"
|
||||
source="share"
|
||||
:action="$t('actions.share')"
|
||||
/>
|
||||
<ToolbarButton v-if="isImage" @click.native="printMethod()" source="print" :action="$t('actions.print')" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import PopoverWrapper from "../Desktop/PopoverWrapper";
|
||||
import PopoverItem from "../Desktop/PopoverItem";
|
||||
import OptionGroup from "../FilesView/OptionGroup";
|
||||
import Option from "../FilesView/Option";
|
||||
import PopoverWrapper from '../Desktop/PopoverWrapper'
|
||||
import PopoverItem from '../Desktop/PopoverItem'
|
||||
import OptionGroup from '../FilesView/OptionGroup'
|
||||
import Option from '../FilesView/Option'
|
||||
|
||||
import ToolbarButton from "../FilesView/ToolbarButton";
|
||||
import {XIcon, MoreHorizontalIcon} from 'vue-feather-icons'
|
||||
import {mapGetters} from 'vuex'
|
||||
import {events} from "../../bus";
|
||||
import ToolbarButton from '../FilesView/ToolbarButton'
|
||||
import { XIcon, MoreHorizontalIcon } from 'vue-feather-icons'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { events } from '../../bus'
|
||||
|
||||
export default {
|
||||
name: 'FilePreviewToolbar',
|
||||
components: {
|
||||
MoreHorizontalIcon,
|
||||
PopoverWrapper,
|
||||
ToolbarButton,
|
||||
PopoverItem,
|
||||
OptionGroup,
|
||||
Option,
|
||||
XIcon,
|
||||
export default {
|
||||
name: 'FilePreviewToolbar',
|
||||
components: {
|
||||
MoreHorizontalIcon,
|
||||
PopoverWrapper,
|
||||
ToolbarButton,
|
||||
PopoverItem,
|
||||
OptionGroup,
|
||||
Option,
|
||||
XIcon,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['fastPreview', 'clipboard', 'entries']),
|
||||
currentFile() {
|
||||
return this.fastPreview ? this.fastPreview : this.clipboard[0]
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'fastPreview',
|
||||
'clipboard',
|
||||
'entries'
|
||||
]),
|
||||
currentFile() {
|
||||
return this.fastPreview ? this.fastPreview : this.clipboard[0]
|
||||
},
|
||||
sharingTitle() {
|
||||
return this.currentFile.data.relationships.shared
|
||||
? this.$t('context_menu.share_edit')
|
||||
: this.$t('context_menu.share')
|
||||
},
|
||||
isImage() {
|
||||
return this.currentFile.data.type === 'image'
|
||||
},
|
||||
isPdf() {
|
||||
return this.currentFile.data.attributes.mimetype === 'pdf'
|
||||
},
|
||||
files() {
|
||||
let files = []
|
||||
|
||||
this.entries.map(element => {
|
||||
|
||||
if (this.currentFile.data.attributes.mimetype === 'pdf') {
|
||||
|
||||
if (element.data.attributes.mimetype === 'pdf')
|
||||
files.push(element)
|
||||
|
||||
} else {
|
||||
|
||||
if (element.data.type === this.currentFile.data.type)
|
||||
files.push(element)
|
||||
}
|
||||
})
|
||||
|
||||
return files
|
||||
},
|
||||
showingImageIndex() {
|
||||
let activeIndex = undefined
|
||||
|
||||
this.files.forEach((element, index) => {
|
||||
if (element.data.id === this.currentFile.data.id) {
|
||||
activeIndex = index + 1
|
||||
}
|
||||
})
|
||||
|
||||
return activeIndex
|
||||
},
|
||||
canShareItem() {
|
||||
return this.$isThisRoute(this.$route, ['Files', 'RecentUploads', 'MySharedItems'])
|
||||
},
|
||||
sharingTitle() {
|
||||
return this.currentFile.data.relationships.shared ? this.$t('context_menu.share_edit') : this.$t('context_menu.share')
|
||||
},
|
||||
methods: {
|
||||
showItemContextMenu() {
|
||||
if (this.$isMobile()) {
|
||||
events.$emit('mobile-context-menu:show', this.currentFile)
|
||||
this.$showMobileMenu('file-menu')
|
||||
} else {
|
||||
events.$emit('popover:open', 'file-preview-contextmenu')
|
||||
}
|
||||
},
|
||||
increaseSizeOfPDF() {
|
||||
events.$emit('document-zoom:in')
|
||||
},
|
||||
decreaseSizeOfPDF() {
|
||||
events.$emit('document-zoom:out')
|
||||
},
|
||||
printMethod() {
|
||||
let tab = document.getElementById('printable-file')
|
||||
let win = window.open('', '', 'height=700,width=700')
|
||||
isImage() {
|
||||
return this.currentFile.data.type === 'image'
|
||||
},
|
||||
isPdf() {
|
||||
return this.currentFile.data.attributes.mimetype === 'pdf'
|
||||
},
|
||||
files() {
|
||||
let files = []
|
||||
|
||||
win.document.write(tab.outerHTML)
|
||||
win.document.close()
|
||||
win.print()
|
||||
},
|
||||
downloadItem() {
|
||||
this.$downloadFile(
|
||||
this.currentFile.data.attributes.file_url,
|
||||
this.currentFile.data.attributes.name + '.' + this.currentFile.data.attributes.mimetype
|
||||
)
|
||||
},
|
||||
closeFullPreview() {
|
||||
events.$emit('file-preview:hide')
|
||||
this.entries.map((element) => {
|
||||
if (this.currentFile.data.attributes.mimetype === 'pdf') {
|
||||
if (element.data.attributes.mimetype === 'pdf') files.push(element)
|
||||
} else {
|
||||
if (element.data.type === this.currentFile.data.type) files.push(element)
|
||||
}
|
||||
})
|
||||
|
||||
return files
|
||||
},
|
||||
showingImageIndex() {
|
||||
let activeIndex = undefined
|
||||
|
||||
this.files.forEach((element, index) => {
|
||||
if (element.data.id === this.currentFile.data.id) {
|
||||
activeIndex = index + 1
|
||||
}
|
||||
})
|
||||
|
||||
return activeIndex
|
||||
},
|
||||
canShareItem() {
|
||||
return this.$isThisRoute(this.$route, ['Files', 'RecentUploads', 'MySharedItems'])
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
showItemContextMenu() {
|
||||
if (this.$isMobile()) {
|
||||
events.$emit('mobile-context-menu:show', this.currentFile)
|
||||
this.$showMobileMenu('file-menu')
|
||||
} else {
|
||||
events.$emit('popover:open', 'file-preview-contextmenu')
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
increaseSizeOfPDF() {
|
||||
events.$emit('document-zoom:in')
|
||||
},
|
||||
decreaseSizeOfPDF() {
|
||||
events.$emit('document-zoom:out')
|
||||
},
|
||||
printMethod() {
|
||||
let tab = document.getElementById('printable-file')
|
||||
let win = window.open('', '', 'height=700,width=700')
|
||||
|
||||
win.document.write(tab.outerHTML)
|
||||
win.document.close()
|
||||
win.print()
|
||||
},
|
||||
downloadItem() {
|
||||
this.$downloadFile(this.currentFile.data.attributes.file_url, this.currentFile.data.attributes.name + '.' + this.currentFile.data.attributes.mimetype)
|
||||
},
|
||||
closeFullPreview() {
|
||||
events.$emit('file-preview:hide')
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -300,9 +293,7 @@
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
|
||||
.context-menu {
|
||||
|
||||
.name-wrapper {
|
||||
width: 67%;
|
||||
}
|
||||
@@ -355,4 +346,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
<template>
|
||||
<audio
|
||||
:class="{'file-shadow': ! $isMobile() }"
|
||||
class="file audio"
|
||||
:src="file.data.attributes.file_url"
|
||||
controls>
|
||||
</audio>
|
||||
<audio :class="{ 'file-shadow': !$isMobile() }" class="file audio" :src="file.data.attributes.file_url" controls></audio>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Audio',
|
||||
props: [
|
||||
'file'
|
||||
],
|
||||
}
|
||||
</script>
|
||||
export default {
|
||||
name: 'Audio',
|
||||
props: ['file'],
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,27 +1,18 @@
|
||||
<template>
|
||||
<img
|
||||
id="printable-file"
|
||||
class="file"
|
||||
:class="{'file-shadow': ! $isMobile() }"
|
||||
:src="imageSource"
|
||||
/>
|
||||
<img id="printable-file" class="file" :class="{ 'file-shadow': !$isMobile() }" :src="imageSource" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'ImageFile',
|
||||
props: [
|
||||
'file'
|
||||
],
|
||||
computed: {
|
||||
imageSource() {
|
||||
let windowWidth = window.innerWidth
|
||||
export default {
|
||||
name: 'ImageFile',
|
||||
props: ['file'],
|
||||
computed: {
|
||||
imageSource() {
|
||||
let windowWidth = window.innerWidth
|
||||
|
||||
if (windowWidth > 1280)
|
||||
return this.file.data.attributes.thumbnail.xl
|
||||
else
|
||||
return this.file.data.attributes.thumbnail.lg
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
if (windowWidth > 1280) return this.file.data.attributes.thumbnail.xl
|
||||
else return this.file.data.attributes.thumbnail.lg
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,116 +1,112 @@
|
||||
<template>
|
||||
<div id="pdf-wrapper" :style="{width: documentSize + '%'}">
|
||||
<!-- <pdf :src="pdfData" v-for="i in numPages" :key="i" :resize="true" :page="i" scale="page-width" style="width:100%; margin:0 auto 35px;" id="printable-file" class="pdf-file">
|
||||
<div id="pdf-wrapper" :style="{ width: documentSize + '%' }">
|
||||
<!-- <pdf :src="pdfData" v-for="i in numPages" :key="i" :resize="true" :page="i" scale="page-width" style="width:100%; margin:0 auto 35px;" id="printable-file" class="pdf-file">
|
||||
<template slot="loading">
|
||||
<h1>loading content...</h1>
|
||||
</template>
|
||||
</pdf>-->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//todo: resolve pdf
|
||||
//todo: resolve pdf
|
||||
|
||||
import {events} from "../../../bus";
|
||||
//import pdf from 'pdfvuer'
|
||||
import { events } from '../../../bus'
|
||||
//import pdf from 'pdfvuer'
|
||||
|
||||
export default {
|
||||
name: 'PdfFile',
|
||||
components: {
|
||||
//pdf,
|
||||
},
|
||||
props: [
|
||||
'file'
|
||||
],
|
||||
watch: {
|
||||
file() {
|
||||
this.getPdf()
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pdfData: undefined,
|
||||
numPages: 0,
|
||||
documentSize: 50,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getPdf() {
|
||||
this.pdfData = undefined
|
||||
this.numPages = 0
|
||||
export default {
|
||||
name: 'PdfFile',
|
||||
components: {
|
||||
//pdf,
|
||||
},
|
||||
props: ['file'],
|
||||
watch: {
|
||||
file() {
|
||||
this.getPdf()
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pdfData: undefined,
|
||||
numPages: 0,
|
||||
documentSize: 50,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getPdf() {
|
||||
this.pdfData = undefined
|
||||
this.numPages = 0
|
||||
|
||||
let self = this;
|
||||
let self = this
|
||||
|
||||
//self.pdfData = pdf.createLoadingTask(this.file.data.attributes.file_url);
|
||||
//self.pdfData = pdf.createLoadingTask(this.file.data.attributes.file_url);
|
||||
|
||||
//self.pdfData.then(pdf => self.numPages = pdf.numPages);
|
||||
},
|
||||
getDocumentSize() {
|
||||
if (window.innerWidth < 960) {
|
||||
this.documentSize = 100
|
||||
}
|
||||
//self.pdfData.then(pdf => self.numPages = pdf.numPages);
|
||||
},
|
||||
getDocumentSize() {
|
||||
if (window.innerWidth < 960) {
|
||||
this.documentSize = 100
|
||||
}
|
||||
|
||||
if (window.innerWidth > 960){
|
||||
this.documentSize = localStorage.getItem('documentSize')
|
||||
? parseInt(localStorage.getItem('documentSize'))
|
||||
: 50;
|
||||
}
|
||||
},
|
||||
zoomIn() {
|
||||
if (this.documentSize < 100) {
|
||||
this.documentSize += 10
|
||||
localStorage.setItem('documentSize', this.documentSize)
|
||||
}
|
||||
},
|
||||
zoomOut() {
|
||||
if (this.documentSize > 40) {
|
||||
this.documentSize -= 10
|
||||
localStorage.setItem('documentSize', this.documentSize)
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDocumentSize()
|
||||
this.getPdf()
|
||||
if (window.innerWidth > 960) {
|
||||
this.documentSize = localStorage.getItem('documentSize') ? parseInt(localStorage.getItem('documentSize')) : 50
|
||||
}
|
||||
},
|
||||
zoomIn() {
|
||||
if (this.documentSize < 100) {
|
||||
this.documentSize += 10
|
||||
localStorage.setItem('documentSize', this.documentSize)
|
||||
}
|
||||
},
|
||||
zoomOut() {
|
||||
if (this.documentSize > 40) {
|
||||
this.documentSize -= 10
|
||||
localStorage.setItem('documentSize', this.documentSize)
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getDocumentSize()
|
||||
this.getPdf()
|
||||
|
||||
events.$on('document-zoom:in', () => this.zoomIn())
|
||||
events.$on('document-zoom:out', () => this.zoomOut())
|
||||
}
|
||||
}
|
||||
events.$on('document-zoom:in', () => this.zoomIn())
|
||||
events.$on('document-zoom:out', () => this.zoomOut())
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--<style src="pdfvuer/dist/pdfvuer.css" lang="css"></style>-->
|
||||
<style lang="scss" scoped>
|
||||
@import '../../../../sass/vuefilemanager/variables';
|
||||
@import '../../../../sass/vuefilemanager/variables';
|
||||
|
||||
#pdf-wrapper {
|
||||
border-radius: 8px;
|
||||
overflow-y: scroll;
|
||||
margin: 0 auto;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1;
|
||||
padding: 40px;
|
||||
#pdf-wrapper {
|
||||
border-radius: 8px;
|
||||
overflow-y: scroll;
|
||||
margin: 0 auto;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1;
|
||||
padding: 40px;
|
||||
|
||||
.pdf-file {
|
||||
box-shadow: $light_mode_popup_shadow;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
.pdf-file {
|
||||
box-shadow: $light_mode_popup_shadow;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 960px) {
|
||||
#pdf-wrapper {
|
||||
border-radius: 0;
|
||||
padding: 0;
|
||||
@media only screen and (max-width: 960px) {
|
||||
#pdf-wrapper {
|
||||
border-radius: 0;
|
||||
padding: 0;
|
||||
|
||||
.pdf-file {
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.pdf-file {
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,60 +1,58 @@
|
||||
<template>
|
||||
<div class="video-wrapper">
|
||||
<video
|
||||
:src="file.data.attributes.file_url"
|
||||
class="video"
|
||||
:class="{'file-shadow': !$isMobile() }"
|
||||
controlsList="nodownload"
|
||||
disablePictureInPicture
|
||||
playsinline
|
||||
controls
|
||||
autoplay
|
||||
/>
|
||||
</div>
|
||||
<div class="video-wrapper">
|
||||
<video
|
||||
:src="file.data.attributes.file_url"
|
||||
class="video"
|
||||
:class="{ 'file-shadow': !$isMobile() }"
|
||||
controlsList="nodownload"
|
||||
disablePictureInPicture
|
||||
playsinline
|
||||
controls
|
||||
autoplay
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Video',
|
||||
props: [
|
||||
'file'
|
||||
],
|
||||
}
|
||||
export default {
|
||||
name: 'Video',
|
||||
props: ['file'],
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../../../../sass/vuefilemanager/variables';
|
||||
@import '../../../../sass/vuefilemanager/variables';
|
||||
|
||||
.video-wrapper {
|
||||
max-width: 1080px;
|
||||
max-height: 100%;
|
||||
.video-wrapper {
|
||||
max-width: 1080px;
|
||||
max-height: 100%;
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
& {
|
||||
max-width: 800px;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
& {
|
||||
max-width: 800px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1920px) and (max-width: 2560px) {
|
||||
& {
|
||||
max-width: 1080px;
|
||||
}
|
||||
}
|
||||
@media (min-width: 2560px) and (max-width: 3840px) {
|
||||
& {
|
||||
max-width: 1440px;
|
||||
}
|
||||
}
|
||||
@media (min-width: 3840px) {
|
||||
& {
|
||||
max-width: 2160px;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1920px) and (max-width: 2560px) {
|
||||
& {
|
||||
max-width: 1080px;
|
||||
}
|
||||
}
|
||||
@media (min-width: 2560px) and (max-width: 3840px) {
|
||||
& {
|
||||
max-width: 1440px;
|
||||
}
|
||||
}
|
||||
@media (min-width: 3840px) {
|
||||
& {
|
||||
max-width: 2160px;
|
||||
}
|
||||
}
|
||||
|
||||
.video {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
align-self: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.video {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
align-self: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user