mirror of
https://github.com/readest/readest.git
synced 2026-12-01 13:36:39 +00:00
* feat(xray): underline known names in the text, tap for X-Ray (#8015) A new switch under Manage Dictionaries > X-Ray, Underline Names in the Text, off by default, draws a dotted underline under every name and alias the X-Ray knows up to the current page. A tap on one opens its X-Ray card, or shows it in the Notebook's X-Ray tab while that is open. It uses the stored X-Ray and asks no AI, and the card keeps its spoiler limit. The underlines are a CSS custom highlight, so the book's DOM is left as it is for CFIs, annotations and Read Aloud. Links and Word Lens hints are skipped, and names match on whole words the way X-Ray's mentions do (CJK names without word boundaries). They are redrawn for each new section and each X-Ray update. WebKit before 17.2 has no custom highlights and shows none. The setting syncs with the other dictionary settings, and its two strings are translated in all 34 locales. Verification: - Fails without the change: - AnnotatorLookupSurfaces.test.tsx, "opens the X-Ray of the name alone": no dictionary-surface. "shows it in the X-Ray tab while that is on screen": "expected undefined to be 'Alice'". - iframeEventHandlers.test.ts, "opens its X-Ray instead of turning the page": dispatch never called with 'xray-name'. - CustomDictionaries.test.tsx: no checkbox named "Underline Names in the Text". - custom-dictionary-store.test.ts (after a load) and the sync settings.test.ts round-trip: "expected undefined to be true". With the change they pass, with the new useXRayNames.test.ts and xrayNames.browser.test.ts (Chromium and WebKit 4/4), and the related suites (24 files, 364 tests). - pnpm lint and pnpm format:check pass, on the change rebased onto main. - Android 17 emulator, debug APK, Alice in Wonderland: - After Update X-Ray, all 23 "Alice"s in Chapter 3 were underlined. A tap on one opened its X-Ray card alone, and a tap on plain text turned the page. - At the start of Chapter 1, before the first X-Ray batch ends, no name was underlined. From Chapter 2 on they were. Switched off, none was. - Checked in light, dark and e-ink. Not run: the docked X-Ray tab on a tablet (a unit test covers it), Word Lens on at the same time, and iOS. Whether X-Ray is available is read when the section changes, so after a sign-in while reading the names show from the next section on. Reported by Zack9476 on GitHub. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(xray): underline names as the page and the text change (#8015) From the review: - Names were picked once per section. A turn within a section now re-reads them, so a name the page reaches is underlined and one ahead of it is not. Most turns reach no new name and leave the page alone. - Word Lens moving a hinted name into a <ruby>, or back out, emptied its underline until the section changed. The names are marked again when Word Lens or a translation rewrites the text (the annotator's contentEpoch). - A name broken by a line of the source, "White\n Rabbit", now matches. X-Ray's mentions share the pattern. Verification, each failing before the change: - useXRayNames.test.ts: - "marks a name the page reaches…": "expected [ … ] to have a length of 1 but got 2". - "marks again once Word Lens or a translation rewrites the text": "… to have a length of 2 but got 1". - AnnotatorPageTurn.test.tsx: the hook got { location: 'ch2.xhtml' }, the section, not the page. - xrayNames.browser.test.ts: "expected [] to deeply equal [ 'White\n Rabbit' ]". Now 5/5 in Chromium and WebKit. The reader, components, store, sync, xray and dictionaries suites pass (472 files, 5049 tests). pnpm lint and pnpm format:check pass, on the branch rebased onto main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(xray): keep the view stable in the X-Ray revision and premium tests (#8015) From the review: both tests built a new view on every render, which reran the hook's effect on its own, so they passed even without the revision dependency. With the view built once, dropping `revision` from the deps fails both: "marks the names a new X-Ray knows" and "clears the names without premium". With it, the 7 hook tests pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| readest-app | ||
| readest-calibre-plugin | ||
| readest-crosspoint-plugin | ||
| readest.koplugin | ||