Skip to main content

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 with empty, target (TextTarget or null), activeMarks, and optionally text when includeText: true.

Input fields

Example request

Output fields

Example response

Pre-apply throws

  • INVALID_INPUT
  • INVALID_CONTEXT

Non-applied failure codes

  • None

Raw schemas