Write patch over selection. A no-op with no active edit, with a
collapsed caret (there is no range to style — patch the node's
TextStyle instead), or with an empty patch. The caret survives, so a
second style can be applied without re-selecting, and rangeStyle
reflects the write before this returns.
Bind to the element wrapping <SceneCanvas> (the same element
passed as container, or any ancestor that receives the dblclick
bubble). The handler looks up the canvas via e.target, hits the
top-most text node under the cursor via pointInTextPose, resolves
a caret offset via caretIndexAt, and starts edit on that node.
The styling shared by every run in selection — a concrete value where
the range agrees, MIXED where it doesn't. null exactly when
selection is null. A collapsed caret reports {}: no run is in
range, so the range reader has nothing to say and the node's style is
what applies.
The caret's character range, or null when nothing is being edited. A
collapsed caret reports { start: n, end: n }, so null and "caret at
n" stay distinguishable — a character-styling control routes the
collapsed case to the node's TextStyle instead of to a range.
Follows the DOM selection, which browsers (and jsdom) report from a task
rather than synchronously; anything this hook writes itself updates it
synchronously. A DOM selection that leaves the overlay does not clear
it: that is what happens when the user clicks a styling control, and
reporting null there would read as "collapsed caret" and send the
control's patch to the node instead of to the range. It is cleared on
startEdit and when the edit ends.
Return shape extends
UseTextEditReturnwith anonDoubleClickbinding for the canvas container. Double-clicking inside a text node enters edit mode with the caret seeded at the clicked glyph.