Summary
Read the editor’s current selection as a portable SelectionInfo with a text-anchored TextTarget. Primitive for building custom comments UIs, floating toolbars, and other selection-driven components without reaching into ProseMirror internals.- Operation ID:
selection.current - API member path:
editor.doc.selection.current(...) - Mutates document:
no - Idempotency:
idempotent - Supports tracked mode:
no - Supports dry run:
no - Deterministic target resolution:
yes
Expected result
Returns a SelectionInfo withempty, target (TextTarget or null), activeMarks, and optionally text when includeText: true.
Input fields
| Field | Type | Required | Description |
|---|---|---|---|
includeText | boolean | no |
Example request
Output fields
| Field | Type | Required | Description | |
|---|---|---|---|---|
activeMarks | string[] | yes | ||
empty | boolean | yes | ||
target | TextTarget \ | null | yes | One of: TextTarget, null |
text | string | no |
Example response
Pre-apply throws
INVALID_INPUTINVALID_CONTEXT
Non-applied failure codes
- None
Raw schemas
Raw input schema
Raw input schema
Raw output schema
Raw output schema

