Reader: visible text selection in every theme; highlights follow across translations
Build and Push Docker Image / build-and-push (push) Failing after 19s

Selection
- Selected text uses a per-theme colour (it was nearly invisible on Dark)
- The colour picker also appears on touch screens after dragging the selection
  handles, and sits below the selection there so the system menu doesn't cover it

Highlights
- Each highlight remembers its translation and whether it covers the whole verse
- In another translation the same words are found again (ignoring case and
  punctuation); whole-verse highlights cover the whole verse; when the wording
  differs, the verse gets a small colour dot instead of marking the wrong words
- Older highlights are checked against their saved words instead of trusted
- Server keeps the new fields

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Sonnet 5.5 committed 2026-10-06 09:55:09 -04:00
1 parent aabd4267b8
commit a0971eab29
9 files changed
+189 -38

No files matched your search

+3
View File
@@ -36,6 +36,9 @@ export function cleanMarks(body) {
};
// The highlighted words, kept so lists of highlights can show them without loading the chapter
if (typeof h.text === 'string' && h.text.length > 0) entry.text = h.text.slice(0, 500);
// Which translation the words were selected in, and whether it is a whole-verse highlight
if (typeof h.translation === 'string' && /^[A-Za-z0-9]{2,8}$/.test(h.translation)) entry.translation = h.translation;
if (h.whole === true) entry.whole = true;
highlights.push(entry);
}
}
+12
View File
@@ -58,3 +58,15 @@ test('the database keeps one row per user and updatedAt only moves forward', asy
expect(saved.highlights).toHaveLength(1);
expect(db.getReaderMarks('u2').updatedAt).toBe(0); // other users are untouched
});
test('a highlight keeps the translation it was made in and whether it covers the whole verse', async () => {
const { cleanMarks } = await import('./readerMarks.js');
const base = { id: 'a', book: 'JHN', chapter: 3, verse: 16, startOffset: 0, endOffset: 40, color: '#fef08a', text: 'For God so loved' };
const out = cleanMarks({ highlights: [
{ ...base, translation: 'BSB', whole: true },
{ ...base, id: 'b', translation: 'not a code!!', whole: 'yes' },
] }).highlights;
expect(out[0]).toMatchObject({ translation: 'BSB', whole: true });
expect(out[1].translation).toBeUndefined();
expect(out[1].whole).toBeUndefined();
});