From 99a3bccc72d3d41e4fcfe244cdfafdb9488d9bba Mon Sep 17 00:00:00 2001 From: rdrew Date: Tue, 10 Nov 2026 10:54:51 -0400 Subject: [PATCH] annotation spaces --- js/fix-annotation-spaces.js | 19 +++++++++++++++++++ oliveskspaces.libraries.yml | 1 + 2 files changed, 20 insertions(+) create mode 100644 js/fix-annotation-spaces.js diff --git a/js/fix-annotation-spaces.js b/js/fix-annotation-spaces.js new file mode 100644 index 0000000..21afbcf --- /dev/null +++ b/js/fix-annotation-spaces.js @@ -0,0 +1,19 @@ +(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); diff --git a/oliveskspaces.libraries.yml b/oliveskspaces.libraries.yml index 9399bd9..0bcb790 100755 --- a/oliveskspaces.libraries.yml +++ b/oliveskspaces.libraries.yml @@ -57,6 +57,7 @@ global-styling: js: js/checkbox.js: {} js/custom.js: {} + js/fix-annotation-spaces.js: {} dependencies: - core/drupal