mirror of
https://github.com/nocodb/nocodb.git
synced 2026-05-05 07:26:52 +00:00
fix(nc-gui): try possible attachment sources
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { onKeyDown } from '@vueuse/core'
|
||||
import { useAttachmentCell } from './utils'
|
||||
import { computed, isImage, onClickOutside, ref } from '#imports'
|
||||
import { computed, isImage, onClickOutside, ref, useAttachment } from '#imports'
|
||||
|
||||
const { selectedImage, visibleItems, downloadFile } = useAttachmentCell()!
|
||||
|
||||
@@ -9,6 +9,8 @@ const carouselRef = ref()
|
||||
|
||||
const imageItems = computed(() => visibleItems.value.filter((item) => isImage(item.title, item.mimetype)))
|
||||
|
||||
const { getAttachmentSrc, showFallback, getBackgroundImage } = useAttachment()
|
||||
|
||||
/** navigate to previous image on button click */
|
||||
onKeyDown(
|
||||
(e) => ['Left', 'ArrowLeft', 'A'].includes(e.key),
|
||||
@@ -87,14 +89,14 @@ onClickOutside(carouselRef, () => {
|
||||
placeholder
|
||||
class="!block"
|
||||
:alt="imageItems[props.i].title || `#${props.i}`"
|
||||
:src="imageItems[props.i].url || imageItems[props.i].data"
|
||||
:src="getAttachmentSrc(imageItems[props.i])"
|
||||
:onerror="(e) => showFallback(e, imageItems[props.i])"
|
||||
/>
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<div v-for="item of imageItems" :key="item.url">
|
||||
<div v-for="item of imageItems" :key="getAttachmentSrc(item)">
|
||||
<div
|
||||
:style="{ backgroundImage: `url('${item.url || item.data}')` }"
|
||||
:style="{ backgroundImage: getBackgroundImage(item) }"
|
||||
class="min-w-70vw min-h-70vh w-full h-full bg-contain bg-center bg-no-repeat"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user