DocumentState
A hoistable state holder for a text component that owns the Document the component renders. The state and the bound component share one document, so an edit made through this state is what the component displays, and text the user types into the component is what this state reports - there is no value to keep in sync and no round-trip per keystroke. A caller who needs a document of their own supplies it at rememberDocumentState; content is otherwise read through text and changed through edit.
text and selection are snapshot-observable: reading them inside a composable (or a snapshotFlow collector) subscribes to later edits, so the reader recomposes when the document or the caret changes. text is materialized on demand from the document, so typing does not pay for a full read until a caller actually asks for the whole text.
See also
Properties
Functions
Applies a batch of edits to the document as one compound change. Insertions, replacements and deletions made on the DocumentEditScope are committed together, then the caret is placed as the block requested (its default rests after the last insertion).