From aa0b9406412e304608ceadc5cc404f66f04e4395 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Tue, 2 Dec 2025 20:19:52 -0500 Subject: [PATCH] Normalize whitespace when copying verse text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Collapses multiple spaces/newlines into single spaces for cleaner clipboard content. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- kjvstudy_org/templates/chapter.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kjvstudy_org/templates/chapter.html b/kjvstudy_org/templates/chapter.html index b413b5a..8f2c073 100644 --- a/kjvstudy_org/templates/chapter.html +++ b/kjvstudy_org/templates/chapter.html @@ -748,12 +748,13 @@ document.addEventListener('DOMContentLoaded', function() { // Remove sidenotes, marginnotes, labels, and verse number links temp.querySelectorAll('.sidenote, .marginnote, .sidenote-number, .margin-toggle, .verse-number-link').forEach(el => el.remove()); - // Get clean text - const cleanText = temp.textContent || temp.innerText || ''; + // Get clean text and normalize whitespace + let cleanText = temp.textContent || temp.innerText || ''; + cleanText = cleanText.replace(/\s+/g, ' ').trim(); - if (cleanText.trim()) { + if (cleanText) { e.preventDefault(); - e.clipboardData.setData('text/plain', cleanText.trim()); + e.clipboardData.setData('text/plain', cleanText); } });