(function (Drupal, once) { Drupal.behaviors.fixMiradorAnnotationSpaces = { attach: function (context, settings) { // Find all Mirador annotation HTML content wrappers const annotationElements = once( "fix-annotation-spaces", ".mirador-third-party-html", context ); annotationElements.forEach((el) => { // Replace both the literal ' ' string and the non-breaking space character (\u00A0) el.innerHTML = el.innerHTML .replace(/ /g, " ") .replace(/\u00A0/g, " "); }); }, }; })(Drupal, once);