Image blocks are contenteditable=false so the text caret can never
live inside them. The drawer never entered image mode and the user
had no visible "selected image" state. Fixed with a separate atomic-
block selection layer:
- New provider state `selectedBlockIndex` (number | undefined) for
atomic block selection. Distinct from text selection.
- `currentBlock` derived now short-circuits to the atomic block's
type when `selectedBlockIndex` is set, so the drawer enters image
mode whenever the user has selected an image.
- New methods `selectAtomicBlock(blockIndex)` + `clearSelectedBlock()`
on the provider. selectAtomicBlock also focuses the editor root so
keyboard handlers (esc, delete) work on the atomic block.
- `syncSelectionFromDom` clears the atomic-block highlight only when
the text selection actually moved (was clearing on every
selectionchange echo, which wiped the highlight a tick after the
click landed).
- Provider onclick handler detects clicks on figure[data-words-block=
'image'][data-words-path], decodes the path, calls
selectAtomicBlock(blockIndex).
- Render passes `selectedBlockIndex` through findOpts; image block
render adds `data-words-block-selected` attr when the index matches.
- Eidos CSS paints a 3px accent outline + glow on the selected
figure. Image panel's imageBlockAtCaret() now falls back to
selectedBlockIndex first, then text-selection anchor.
Result: clicking an image in the editor now highlights it (accent
outline + glow), the drawer enters IMAGE mode and shows its
source/alt/caption/status panel.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>