Skip to content

Commit

Permalink
fix: Open in new tab does not work
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarsen136 committed Oct 14, 2024
1 parent 53f38bc commit 173ad7b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 7 additions & 2 deletions components/gallery/GalleryItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="flex flex-col lg:flex-row">
<div class="w-full lg:w-2/5 lg:pr-7 group">
<div
id="nft-img-container"
:id="CONTAINER_ID"
ref="imgref"
:class="{
'relative': !isFullscreen,
Expand Down Expand Up @@ -41,7 +41,10 @@
:audio-player-cover="image"
/>
</div>
<GalleryItemToolBar @toggle="toggleFullscreen" />
<GalleryItemToolBar
:container-id="CONTAINER_ID"
@toggle="toggleFullscreen"
/>
</div>

<div class="w-full lg:w-3/5 lg:pl-5 py-7">
Expand Down Expand Up @@ -188,6 +191,8 @@ import { sanitizeIpfsUrl, toOriginalContentUrl } from '@/utils/ipfs'
import { convertMarkdownToText } from '@/utils/markdown'
import { generateNftImage } from '@/utils/seoImageGenerator'
const CONTAINER_ID = 'nft-img-container'
const NuxtImg = resolveComponent('NuxtImg')
const { urlPrefix } = usePrefix()
Expand Down
6 changes: 5 additions & 1 deletion components/gallery/GalleryItemToolBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ type ReloadElement =
defineEmits(['toggle'])
const props = defineProps<{
containerId: string
}>()
const { getNft: nft, getNftImage: nftImage, getNftMimeType: nftMimeType, getNftAnimation: nftAnimation, getNftAnimationMimeType: nftAnimationMimeType } = storeToRefs(useNftStore())
const isLoading = ref(false)
Expand Down Expand Up @@ -126,7 +130,7 @@ const handleReloadClick = () => {
}
const openInNewTab = (selector: string, attribute: string = 'src') => {
const element = document.querySelector(selector)
const element = document.querySelector(`#${props.containerId} ${selector}`)
if (element) {
const src = element.getAttribute(attribute)
if (src) {
Expand Down

0 comments on commit 173ad7b

Please sign in to comment.