How to hook into interactivity API used for a core block ? #71706
Fab1en
started this conversation in
Interactivity API
Replies: 2 comments
-
|
Here is the live page where you can see the old working version on WordPress 6.2 : https://noria-research.com/photoreport-young-living-in-halabja/ |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Hey @Fab1en, two things:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to implement a very simple gallery on top of the existing lightbox for code image blocks.
I'm using WordPress 6.8.2.
I have a gallery of images for which I have checked the "Enlarge on click" option
This toggle the lightbox behavior : when I click on an image, it is displayed fullscreen on top of other content.
What I want now is adding Previous and Next buttons on this lightbox interface so that I can navigate to previous and next images in the gallery without closing and reopening the lightbox interface.
I was able to insert the HTML code at the right place in the lightbox interface, but I can't figure out how to use the interactive API to trigger the next image display.
My code looks like this :
The
nextaction is correctly triggered when I click on the Next button.Each image in the gallery has the following attribute :
data-wp-on-async--click="actions.showLightbox"I would like to be able to call this
showLightboxaction from my own interactive API store, but I can't. ThecontextI try to get fromcore/imageis just an object without properties, and when I try to get the state withI get a "Cannot unlock a private store with an invalid lock code" error.
Previously, I was using WordPress 6.2.3 with Gutenberg 16.8.1 plugin. This old version of the lightbox gallery was working with the following code :
How can I adapt it to the latest WordPress version ?
Beta Was this translation helpful? Give feedback.
All reactions