Gallery Block: Enable br tag in Lightbox Text

Description: If you use <br/> in Title, it will appears as <br/> in Lightbox. The code will force <br/> work in Title + Lightbox text.

Use this code to Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  function processText() {
    $(".image-slide-title, div.sqs-lightbox-meta h1").each(function(){
      var encodedText = $(this).html();
      var decodedText = encodedText
        .replace(/&lt;/g, '<')
        .replace(/&gt;/g, '>')
        .replace(/&amp;/g, '&')
        .replace(/&quot;/g, '"')
        .replace(/'/g, "'")
        .replace(///g, '/');
      $(this).html(decodedText);
    });
  }
  
  processText();
  
  var observer = new MutationObserver(function(mutations) {
    mutations.forEach(function(mutation) {
      mutation.addedNodes.forEach(function(node) {
        if (node.nodeType === 1) {
          if ($(node).hasClass('yui3-lightbox2') || $(node).find('.sqs-lightbox-meta').length) {
            setTimeout(processText, 100);
          }
        }
      });
    });
  });
  
  observer.observe(document.body, {
    childList: true,
    subtree: true
  });
  
  $(document).on('DOMNodeInserted', '.sqs-lightbox-meta', function() {
    setTimeout(processText, 50);
  });
});
</script>

Buy me a coffee