gabrielcsapo / gabrielcsapo/docusaurus-plugin-image-zoom

Plugin doesn't work properly with @docusaurus/plugin-ideal-image

Open
#6 8 comments 1 reaction 0 assignees View on GitHub
enhancement help wanted
Dominant language
JavaScript
Stars
84
Forks
16
PR merge metrics
No merged PRs in 30d

Description

Hello again!

I have discovered a bug when using this plugin with the [@docusaurus/plugin-ideal-image][ideal-image] plugin.

Initially, the ideal images plugin renders images to the document like this:

```html

A  screenshot of the profile drop-down menu


```

Then, when the `div` element enters the viewport, it gets mutated to:

```html


A  screenshot of the profile drop-down menu

```

However, it looks like the replacement image doesn't get passed to a `mediumZoom` function call, meaning that any images that load in as you scroll are not zoomable.

I notice that you're observing attributes to update the background color (presumably for when the user switch between light and dark mode). I also notice that you seem to be waiting for new page loads, so that you can reinitialize the `zoomObject` for any new images.

(Please note, I am not a JavaScript developer, so all of this is just my best guess.)

Do you think it would be possible to fix this issue by observing for subtree mutations on the `article` elements, and then reinitializing the `zoomObject`, like you do with a new page?

[ideal-image]: https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-ideal-image

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.