Browse Source

fix(nc-gui): show LazyCellAttachmentImage for images only

pull/5046/head
Wing-Kam Wong 2 years ago
parent
commit
4cf26182a0
  1. 6
      packages/nc-gui/components/cell/attachment/index.vue
  2. 15
      packages/nc-gui/components/smartsheet/Gallery.vue

6
packages/nc-gui/components/cell/attachment/index.vue

@ -221,13 +221,11 @@ useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e) => {
<template #title>
<div class="text-center w-full">{{ item.title }}</div>
</template>
<template v-if="isImage(item.title, item.mimetype ?? item.type)">
<div v-if="isImage(item.title, item.mimetype ?? item.type)">
<div class="nc-attachment flex items-center justify-center" @click.stop="selectedImage = item">
<LazyCellAttachmentImage :alt="item.title || `#${i}`" :src="getPossibleAttachmentSrc(item)" />
</div>
</template>
</div>
<div v-else class="nc-attachment flex items-center justify-center" @click="openAttachment(item)">
<component :is="FileIcon(item.icon)" v-if="item.icon" />

15
packages/nc-gui/components/smartsheet/Gallery.vue

@ -18,6 +18,7 @@ import {
createEventHook,
extractPkFromRow,
inject,
isImage,
isLTAR,
nextTick,
onMounted,
@ -202,12 +203,14 @@ watch(view, async (nextView) => {
<div style="z-index: 1"></div>
</template>
<LazyCellAttachmentImage
v-for="(attachment, index) in attachments(record)"
:key="`carousel-${record.row.id}-${index}`"
class="h-52 object-contain"
:src="getPossibleAttachmentSrc(attachment)"
/>
<template v-for="(attachment, index) in attachments(record)">
<LazyCellAttachmentImage
v-if="isImage(attachment.title, attachment.mimetype ?? attachment.type)"
:key="`carousel-${record.row.id}-${index}`"
class="h-52 object-contain"
:src="getPossibleAttachmentSrc(attachment)"
/>
</template>
</a-carousel>
<MdiFileImageBox v-else class="w-full h-48 my-4 text-cool-gray-200" />

Loading…
Cancel
Save