From 9903d7d7c66c8114abdaed77e2dd93daae214341 Mon Sep 17 00:00:00 2001 From: Maarten Hunink Date: Sun, 5 Sep 2021 16:07:21 +0200 Subject: [PATCH] Fixes #64 --- js/hyperaudio-lite.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/hyperaudio-lite.js b/js/hyperaudio-lite.js index f0551a4..0fdab27 100644 --- a/js/hyperaudio-lite.js +++ b/js/hyperaudio-lite.js @@ -202,6 +202,14 @@ class HyperaudioLite { let fNode = selection.focusNode.parentNode; let aNode = selection.anchorNode.parentNode; + if(selection.focusNode.textContent == ' '){ + fNode = selection.focusNode.nextElementSibling; + } + + if(selection.anchorNode.textContent == ' '){ + aNode = selection.anchorNode.previousElementSibling; + } + if (aNode.getAttribute('data-m') === null || aNode.className === 'speaker') { aNode = aNode.nextElementSibling; }