Files
Rdmclin2 ebe586289d ✨ feat(page-editor): align document comments beside their source text (#19659)
* ✨ feat(page-editor): align document comments beside their source text

Adds a gutter that positions comment threads next to the highlighted
text they annotate instead of stacking them in a flat list below the
document, with per-line quick-comment affordance and anchored/
unanchored thread partitioning in the comment list API.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* 🌐 i18n: sync generated locale translations

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* 🐛 fix(page-editor): hand failed anchored drafts back and bound the gutter's eager load

- A failed anchored submission stashed while a newer draft owned the
  shared slot was written under `anchored-failed:<clientId>` and never
  read again, so the toast was the last the reader saw of their text.
  The provider now moves the stash back into the slot whenever that
  slot frees (the newer draft sent or cancelled, or the next open) and
  republishes its anchor, remounting the gutter composer beside the
  original selection with the failed words and attachments, ready to
  retry. The inline composer, always mounted and already holding the
  slot's state, adopts the stash itself on mount instead.
- Anchored threads were drained to the last page whenever the document
  mounted, panel open or not, and every result mounted twice (gutter and
  list). Fetch ahead only while the gutter shows them, up to
  ANCHORED_EAGER_PAGE_LIMIT pages; a picked highlight past that fetches
  its thread on demand through the existing deep-link pin, and the list
  below the body now pages both caches so the rest stays reachable.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* 🐛 fix(page-editor): forward paging keys from gutter controls and clear the marker over root whitespace

- Keyboard focus usually enters the panel on a card's button or link,
  and the key forwarder skipped every key for any interactive target, so
  PageUp/PageDown from there did nothing: the control has no use for
  them and the browser default cannot scroll the sibling document pane.
  Decide ownership per key — a field or editable region keeps everything
  typed into it, a button or link keeps only Space (its activation).
- Over the body's own whitespace between or after blocks, `blockAt` is
  null and the move handler returned early, leaving the marker for the
  last crossed line actionable for text no longer under the pointer;
  the host-level handler never sees those moves either, since the body
  contains the target. Clear it there unless the pointer is on the
  bridge to (or over) the current marker, the one path meant to survive.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* 🐛 fix(page-editor): report a missing deep-linked reply once when the gutter duplicates the thread

An anchored thread shown in both the gutter and the flat list received
the same focus in both copies, so a deep link to a missing or failed
reply ran both copies' missing-focus effect: two toasts, and the focus
token advanced twice. The flat copy keeps the focus for its highlight
but no longer answers for a miss when the gutter shows the same thread.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* 🐛 fix(page-editor): partition thread pages client-side when the server ignores the scope

The `anchored` filter on listThreads is new in this change. A production
backend predating it strips the unknown key and answers the anchored and
document scopes with the same mixed pages — which is exactly what the
documented debug proxy (latest SPA against app.lobehub.com) produces —
so the two caches overlapped and the list below the body rendered every
such thread twice, with duplicate React keys. Filter each page to its
scope's own subset on the client; the cursor still walks the server's
order, so paging stays consistent.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 17:45:08 +08:00
..
…
…
…