Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glightbox plugin doesn't work when encrypt is enabled #62

Closed
jeetyadav98 opened this issue Feb 2, 2024 · 7 comments
Closed

glightbox plugin doesn't work when encrypt is enabled #62

jeetyadav98 opened this issue Feb 2, 2024 · 7 comments
Labels
help wanted Extra attention is needed

Comments

@jeetyadav98
Copy link

I would like to make images zoom able and clickable, which the mkdocs-glightbox enables. However, it does not seem to work at all when this plugin is installed and active.

Any idea how I can fix this?

@unverbuggt
Copy link
Owner

unverbuggt commented Feb 2, 2024

I didn't test with this plugin. Maybe we just need to re-call some javascript after decryption. I'll check.

Edit: Did you make sure that the plugin order is correct?

plugins:
  - glightbox:
      zoomable: true
      draggable: true
      skip_classes:
        - skip-lightbox
  - encryptcontent: {}

I did a brief test with the plugin's documentation, and it worked kind of (first image I clicked sent the browser to the image, but second click opened the GLightbox).

@jeetyadav98
Copy link
Author

Oh, I never changed the order! I'll have to check.

I didn't know that the order would matter. Is there any reason it does?

@jeetyadav98
Copy link
Author

Yes it works. Thank you!

However, as you noted, the first click opens in browser - not default behavior. Any idea how I could fix this?

@unverbuggt unverbuggt added the help wanted Extra attention is needed label Feb 3, 2024
@unverbuggt
Copy link
Owner

The first-click behaviour is strange indeed. It doesn't trigger any javascript errors or such...

I'd need to dig into how the glightbox plugin works to find the cause. It's probably just some intialization that needs to be triggered. But no idea why it works on the second click.

Not top priority for me at the moment. However, you could try opening an issue here and hope that the developer of the plugin got some ideas.

@lilyildiz
Copy link

I had the same problem, my site was also constantly asking for the password while navigating. I saw #61 and fixing that problem by removing the navigation.instant from mkdocs material features fixed both of the problems for me.

@unverbuggt
Copy link
Owner

Did you also try setting webcrypto: true or esm: true while enabling navigation.instant? This should fix being re-prompted for the password, however it won't fix the glightbox issue.

@unverbuggt
Copy link
Owner

The new Version 0.4.0 of mkdocs-glightbox can be fixed by reload_scripts like this:

plugins:
  - glightbox:
      zoomable: true
      draggable: true
      skip_classes:
        - skip-lightbox
  - encryptcontent:
      reload_scripts:
      - '#init-glightbox'

I'll update the documentation on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants