Gutenberg Post Content - display images in lightbox

Hello everyone,

Coming from a page builder, I’m used to using templates and creating Post Content in basic Gutenberg. When I give a link to an image in Gutenberg (link → “Mediafile”), I would like to open that image in a lightbox.

The Element “Post Content” doesn’t have such a setting. Would it be possible to integrate this?

I can’t find a specific class for a link to a mediafile from Gutenberg, so I guess it would rely on comparing the “Post Image url” to the provided link?

Fingers crossed! Anybody knows a workaround? :pray:t3:

hi

Hi @WeLoVeBricKs,

Thank you for your reply and your suggestion!
Good information, but it triggers at the DOM .wp-block-image (so it isn’t triggered by link → mediafile).

That means that all .wp-block-images can trigger or a lightbox, or that the targeted images would require a custom class. Because the website already has a fair amount of images, I’m not fully happy with either of those options. :sweat_smile:

Do you now if it is possible to “check” if the link is an image and then show the lightbox?