Add link-the-caption
as Additional CSS Class on image block. Caption should contain no other links.
// Auto-link image caption to the same URL as that to which the image has been linked
jQuery(document).ready(function( $ ) {
$('.link-the-caption').each( function() {
let image_link = $(this).attr('href');
let image_caption = $(this).next().html();
$(this).next().html('<a href="'+image_link+'">'+image_caption+'</a>');
});
});