SynchronizedString Interface
The value returned by useTreeSynchronizedString(tree, initialSelection).
To use, import via @fluidframework/react/alpha.
For more information about our API support guarantees, see here.
This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.
Signature
/** @sealed */
export interface SynchronizedString
Properties
| Property | Alerts | Modifiers | Type | Description |
|---|---|---|---|---|
| selection | Alpha | readonly | TextSelection | undefined | A selection range tracked across edits, or undefined when no selection is being tracked. |
| text | Alpha | readonly | string | The tree's current text. |
Property Details
selection
A selection range tracked across edits, or undefined when no selection is being tracked.
For more information about our API support guarantees, see here.
Signature
readonly selection: TextSelection | undefined;
Type: TextSelection | undefined
Remarks
Seeded from the initialSelection passed to useTreeSynchronizedString(tree, initialSelection) and adjusted as the tree's characters change so it follows the same logical position across edits.
Tracking is best-effort: in rare cases the selection may be dropped (become undefined) when it cannot be mapped reliably across a change.
This is not a live caret: the hook does not observe the user's actual cursor, so a consumer that needs the real caret position must read it from the rendered element itself.
text
The tree's current text.
For more information about our API support guarantees, see here.
Signature
readonly text: string;
Type: string