Add filebase improvements
This commit is contained in:
committed by
Jože Fortun
parent
9f172ee6ba
commit
dead68f078
@@ -21,6 +21,21 @@
|
||||
>
|
||||
{{ $t('kind.file.view.showName') }}
|
||||
</b-form-checkbox>
|
||||
|
||||
<b-form-checkbox
|
||||
v-model="options.enablePreview"
|
||||
class="mb-3"
|
||||
>
|
||||
{{ $t('kind.file.view.enablePreview') }}
|
||||
</b-form-checkbox>
|
||||
|
||||
<b-form-checkbox
|
||||
v-model="options.enableDownload"
|
||||
class="mb-3"
|
||||
>
|
||||
{{ $t('kind.file.view.enableDownload') }}
|
||||
</b-form-checkbox>
|
||||
|
||||
<uploader
|
||||
:endpoint="endpoint"
|
||||
:max-filesize="$s('compose.Page.Attachments.MaxSize', 100)"
|
||||
|
||||
@@ -96,12 +96,12 @@
|
||||
|
||||
<div
|
||||
v-else
|
||||
class="single gallery"
|
||||
class="single gallery h-100"
|
||||
>
|
||||
<div
|
||||
v-for="(a) in files"
|
||||
:key="a.attachmentID"
|
||||
class="my-2"
|
||||
class="my-2 mx-auto h-100"
|
||||
>
|
||||
<c-preview-inline
|
||||
v-if="canPreview(a)"
|
||||
@@ -111,6 +111,9 @@
|
||||
:name="a.name"
|
||||
:alt="a.name"
|
||||
:preview-style="{ width: 'unset', ...inlineCustomStyles(a) }"
|
||||
:preview-class="[
|
||||
!previewOptions.enablePreview ? 'disable-zoom-cursor' : ''
|
||||
]"
|
||||
:labels="previewLabels"
|
||||
@openPreview="openLightbox({ ...a, ...$event })"
|
||||
/>
|
||||
@@ -205,7 +208,7 @@ export default {
|
||||
|
||||
computed: {
|
||||
inlineUrl () {
|
||||
return (a) => (this.ext(a) === 'pdf' ? a.download : a.previewUrl)
|
||||
return (a) => (this.ext(a) === 'pdf' ? a.download : (this.previewOptions.enablePreview ? a.previewUrl : a.url))
|
||||
},
|
||||
|
||||
previewLabels () {
|
||||
@@ -287,7 +290,10 @@ export default {
|
||||
},
|
||||
|
||||
openLightbox (e) {
|
||||
this.$root.$emit('showAttachmentsModal', e)
|
||||
if (this.previewOptions.enablePreview) {
|
||||
const { enableDownload } = this.previewOptions
|
||||
this.$root.$emit('showAttachmentsModal', { ...e, enableDownload })
|
||||
}
|
||||
},
|
||||
|
||||
deleteAttachment (index) {
|
||||
@@ -339,6 +345,10 @@ export default {
|
||||
|
||||
if (this.ext(a) === 'image') {
|
||||
return {
|
||||
...((!this.previewOptions.enablePreview || height === '0' || width === '0') && {
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
}),
|
||||
...(height && { height: `${height}px` }),
|
||||
...(width && { width: `${width}px` }),
|
||||
...(maxHeight && { maxHeight: `${maxHeight}px` }),
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</p>
|
||||
|
||||
<a
|
||||
v-if="attachment"
|
||||
v-if="attachment && attachment.enableDownload"
|
||||
slot="header.right"
|
||||
:href="(attachment || {}).download"
|
||||
>
|
||||
@@ -71,7 +71,7 @@ export default {
|
||||
|
||||
created () {
|
||||
window.addEventListener('keyup', this.onKeyUp)
|
||||
this.$root.$on('showAttachmentsModal', ({ url, download, name, document = undefined, meta }) => {
|
||||
this.$root.$on('showAttachmentsModal', ({ url, download, name, document = undefined, meta, enableDownload }) => {
|
||||
this.attachment = {
|
||||
document,
|
||||
download,
|
||||
@@ -79,6 +79,7 @@ export default {
|
||||
src: url,
|
||||
name: name,
|
||||
caption: name,
|
||||
enableDownload,
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user