I quite like the core implementation of Expand on click in Gutenberg’s image block and would like to utilize it not only in posts created in Gutenberg editor, but also on other image elements. To be precise, there are plugins that still use TinyMCE classic richtext editor on some textareas and here the image element cannot be armed with built-in Expand on click function.
My question is: is there a way on how to fire built-in EOC on any image just by storing some proper markup like in case of any other common lightbox implementation? e.g.:
<img src='/my_image.jpg' rel='expand-on-click' />
I know there are tons of lightbox plugins available, but if there’s a function out of the box, I’m trying to avoid installing additional plugins with the same function.
I tried to mimic markup generated and stored in WP_POSTS table by Image Block to no avail:
<!-- wp:image {"lightbox":{"enabled":true},"id":3212,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large">
<img src="/my_image.jpg" alt="" class="wp-image-3212"/>
</figure>
<!-- /wp:image -->
Profesor Qwertius is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.