Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/renderer/extensions/vueNodes/VideoPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,19 @@
</div>

<!-- Loading State -->
<Skeleton v-else-if="isLoading" class="size-full" border-radius="5px" />
<Skeleton
v-if="isLoading && !videoError"
class="absolute inset-0 size-full"
border-radius="5px"
width="16rem"
height="16rem"
/>

<!-- Main Video -->
<video
v-else
v-if="!videoError"
:src="currentVideoUrl"
class="block size-full object-contain"
:class="cn('block size-full object-contain', isLoading && 'invisible')"
controls
loop
playsinline
Expand Down Expand Up @@ -106,6 +112,7 @@ import { useI18n } from 'vue-i18n'

import { downloadFile } from '@/base/common/downloadUtil'
import { useNodeOutputStore } from '@/stores/imagePreviewStore'
import { cn } from '@/utils/tailwindUtil'

interface VideoPreviewProps {
/** Array of video URLs to display */
Expand Down Expand Up @@ -142,7 +149,7 @@ watch(
// Reset loading and error states when URLs change
actualDimensions.value = null
videoError.value = false
isLoading.value = false
isLoading.value = newUrls.length > 0
},
{ deep: true }
)
Expand Down
22 changes: 17 additions & 5 deletions src/renderer/extensions/vueNodes/components/ImagePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,26 @@
</div>

<!-- Loading State -->
<Skeleton v-else-if="isLoading" class="size-full" border-radius="5px" />
<Skeleton
v-if="isLoading && !imageError"
class="absolute inset-0 size-full"
border-radius="5px"
width="16rem"
height="16rem"
/>

<!-- Main Image -->
<img
v-else
v-if="!imageError"
ref="currentImageEl"
:src="currentImageUrl"
:alt="imageAltText"
class="block size-full object-contain pointer-events-none"
:class="
cn(
'block size-full object-contain pointer-events-none',
isLoading && 'invisible'
)
"
@load="handleImageLoad"
@error="handleImageError"
/>
Expand Down Expand Up @@ -118,6 +129,7 @@ import { downloadFile } from '@/base/common/downloadUtil'
import { app } from '@/scripts/app'
import { useCommandStore } from '@/stores/commandStore'
import { useNodeOutputStore } from '@/stores/imagePreviewStore'
import { cn } from '@/utils/tailwindUtil'

interface ImagePreviewProps {
/** Array of image URLs to display */
Expand Down Expand Up @@ -161,7 +173,7 @@ watch(
// Reset loading and error states when URLs change
actualDimensions.value = null
imageError.value = false
isLoading.value = false
isLoading.value = newUrls.length > 0
},
{ deep: true }
)
Expand Down Expand Up @@ -221,7 +233,7 @@ const setCurrentIndex = (index: number) => {
if (index >= 0 && index < props.imageUrls.length) {
currentIndex.value = index
actualDimensions.value = null
isLoading.value = false
isLoading.value = true
imageError.value = false
}
}
Expand Down
Loading