From 1fecbe0df846580f42bbf54a0ba03c04babab2be Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 7 Feb 2023 12:09:56 +0800 Subject: [PATCH] fix(nc-gui): apply getImgSrc and showFallback on Gallery and kanban --- .../nc-gui/components/smartsheet/Gallery.vue | 19 ++++++++++++++++++- .../nc-gui/components/smartsheet/Kanban.vue | 17 ++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/Gallery.vue b/packages/nc-gui/components/smartsheet/Gallery.vue index 0128997248..ed32e305c0 100644 --- a/packages/nc-gui/components/smartsheet/Gallery.vue +++ b/packages/nc-gui/components/smartsheet/Gallery.vue @@ -168,6 +168,22 @@ watch(view, async (nextView) => { await loadGalleryData() } }) + +const { appInfo } = useGlobal() + +const getImgSrc = (item: Record) => { + if (item.data) { + return item.data + } else if (item.path) { + return `${appInfo.value.ncSiteUrl}/${item.path}` + } + return item.url +} + +const showFallback = (evt: any, item: Record) => { + evt.onerror = null + evt.target.src = item.url +}