readest/apps
Huang Xin 003bc6f37f
fix(lite): select a word and look it up as Readest does (owner: "continue")
A double tap on a word in a book did nothing in Lite, and the dictionary
behind it could not show a book's own-language Wiktionary entry: Lite
lacked DOM pieces Readest's selection and lookup use.

- document.caretPositionFromPoint / caretRangeFromPoint. Readest finds
  the word under a double tap with them (also the reading ruler, instant
  highlights and cross-page selections). Blitz maps the point to the
  text node and offset (caret_position_from_point, patches/blitz.diff).
- Range cloneContents, extractContents, deleteContents, insertNode and
  Text.splitText. Readest reads a selection's text from cloneContents:
  makeSelection threw and no popup opened. Word Lens wraps a word with
  extractContents and insertNode.
- A DocumentFragment's children have it as their parentNode and each
  other as siblings (a walk over a cloned multi-paragraph selection
  stopped after its first paragraph), and a fragment has querySelector,
  querySelectorAll, children, textContent and append: the vocabulary
  couldn't read the word's sentence.
- Element.matches is one native match. It queried the parent, which
  recursed for a fragment's child and missed detached elements.
- A node from another document is adopted with its tree, as browsers
  do. The Wiktionary lookup moves the section it shows out of a
  DOMParser document; it threw WrongDocumentError and fell back to the
  English edition.
- before, after and replaceWith, and reflected lang and dir: the lookup
  unwraps links with replaceWith and marks its section's language.

Found with a new parity scenario (in a later commit): a double tap on
"Zimmer" in a German book now opens the selection popup in Lite, and
its dictionary shows the German Wiktionary's entry, as Readest does.
What still differs there: Readest raises superscripts with Tailwind's
`position: relative; top: -0.5em`, which Blitz doesn't apply to an
inline element's text.

Tests, each failing without its change:
- caret_position (4 tests): "not a function".
- range: a_ranges_contents_are_cloned_or_moved_into_a_fragment,
  delete_contents_removes_what_the_range_selects,
  insert_node_splits_the_text_at_the_range_start: "not a function"; the
  walk over the clone lost "fo" until fragments linked their children.
- dom_basics: a_fragments_children_link_to_it_and_each_other
  ("false false false null null"), a_fragment_is_queried_and_read_as_a_
  parent_node and nodes_go_before_after_or_in_place_of_a_child: "not a
  function".
- parsed_documents: an_element_from_a_parsed_document_is_adopted_with_
  its_tree: WrongDocumentError. a_lone_text_node_is_adopted and iframes'
  content_document_is_the_iframes_own expected WrongDocumentError for a
  page node moved into another document; they now expect the move.
cargo test -p blitz-qjs-script: 110 pass (the long-press test of the
next commit fails here, as it should). -p tauri-runtime-blitz: 89 pass.
Parity, Lite rebuilt: library 12/13, library-book 20/22, reader 20/20,
reader-tools 29/30, novel-turns 13/13, as before. One novel-turns run
gave 11/13 while builds ran alongside: a preloaded section was not
styled yet at step 0; it passed twice after.
Not run: the Kindle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 11:30:53 +08:00
..
readest-app feat(auth): hide the magic link where no browser can open (owner: "hide the magic link too") 2026-11-27 11:30:47 +08:00
readest-calibre-plugin
readest-crosspoint-plugin feat(crosspoint): sign in with a code through /api/auth/device (owner: "use a more generic path for /api/crosspoint/device/code") (#7859) 2026-11-24 04:21:00 +01:00
readest-lite fix(lite): select a word and look it up as Readest does (owner: "continue") 2026-11-27 11:30:53 +08:00
readest.koplugin feat(kosync): match file names across readers with a format or a book's own name (#7864) (#7873) 2026-11-24 08:32:36 +01:00