prismicio / prismic-svelte

Svelte components and helpers to fetch and present Prismic content
https://prismic.io/docs/technical-reference/prismicio-svelte
Apache License 2.0
22 stars 6 forks source link

PrismicImage lazy loading Svelte #18

Open GalichCZ opened 11 months ago

GalichCZ commented 11 months ago

I have an issue with handling images with slow internet connection in svelte app using prismic library I've tried to use on:load like this

<script>
  import { PrismicImage } from '@prismicio/svelte'

  const a = () => {
    console.log(1)
  }
</script>
<PrismicImage
        on:load={a}
        on:loadeddata={()=>console.log(1)}
        on:loadedmetadata={()=>console.log(1)}
        loading='lazy'
        style="position: absolute; z-index: 1; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 3rem; -webkit-clip-path: url(#{pathID}); clip-path: url(#{pathID});"
        {field}
        imgixParams={{ q: 30 }}
      />

but there is no any reaction on load and I do not really see any difference if I have loading='lazy'

It is the copy paste of my question on prismic community.

My suggestion is pretty simple, it would be nice to have working on:load handlers in PrismicImage component

BTW, thank you for easy understandable webs and docs :D

github-actions[bot] commented 11 months ago

This issue has been labeled as a feature request since it was created using the šŸ™‹ā€ā™€ļø Feature Request Template.

Hi there, thank you so much for your request!

Following our Maintenance Process, we will review your request and get back to you soon. If we decide to implement it, will proceed to implement the feature during the last week of the month. In the meantime, feel free to provide any details to help us better understand your request, such as:

If you think you can implement the proposed change yourself, you're more than welcome to open a pull request implementing the new feature. Check out our quick start guide for a simple contribution process. Please note that submitting a pull request does not guarantee the feature will be merged.

- The Prismic Open-Source Team