refactor: move selection surgery into rich-text-dom.ts (RD-21)

deleteAdjacentChip and insert did getSelection()/Range work inside the
component, which pushed it over the max-lines budget under a disable
comment. rich-text-dom.ts already owns the DOM boundary, so the surgery
moves there as two new exports, chipAtCaret and insertChipAtCaret, and
the component keeps only its event-handling and output concerns.

adjacentChip stays exported with its own spec case. The component
disable comment is gone, since the file is now under the line budget.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
eho
2026-09-04 22:42:21 +02:00
co-authored by Claude Sonnet 5
parent 8a3e42015b
commit 4b3e6a6cfd
6 changed files with 313 additions and 28 deletions
+9 -1
View File
@@ -20,7 +20,7 @@ tested where._
Every bullet below is a real test name from the suite — an `it()` title (frontend) or a test
method name (backend), read as a sentence. Nothing here is hand-written prose: this page
**is** the suite, reshaped for a business reader. 538 frontend behaviours across
**is** the suite, reshaped for a business reader. 543 frontend behaviours across
9 contexts; 261 backend behaviours across 42 test
classes.
@@ -758,6 +758,14 @@ classes.
- redirects an anonymous user to /login without waiting for caps
- reads authentication through the port, not an app-local store
#### chipAtCaret / insertChipAtCaret (selection surgery)
- chipAtCaret returns the chip before a Backspace caret
- chipAtCaret returns null for a non-collapsed selection
- chipAtCaret returns null for a caret outside root
- insertChipAtCaret splices at the caret and leaves the caret after the chip
- insertChipAtCaret appends when there is no selection inside root
#### createDebouncedSave
- flushes after the delay when canSave is true