> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superdoc.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# selection.current

> 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.

## 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

| Field | Type | Required | Description |
| - | - | - | - |
| `includeText` | boolean | no | |

### Example request

```json theme={null}
{
  "includeText": true
}
```

## Output fields

| Field | Type | Required | Description |
| - | - | - | - |
| `activeChangeIds` | string\[] | yes | |
| `activeCommentIds` | string\[] | yes | |
| `activeMarks` | string\[] | yes | |
| `empty` | boolean | yes | |
| `target` | TextTarget \| null | yes | One of: TextTarget, null |
| `text` | string | no | |

### Example response

```json theme={null}
{
  "activeChangeIds": [
    "example"
  ],
  "activeCommentIds": [
    "example"
  ],
  "activeMarks": [
    "example"
  ],
  "empty": true,
  "target": {
    "kind": "text",
    "segments": [
      {
        "blockId": "block-abc123",
        "range": {
          "end": 10,
          "start": 0
        }
      }
    ],
    "story": {
      "kind": "story",
      "storyType": "body"
    }
  },
  "text": "Hello, world."
}
```

## Pre-apply throws

* `INVALID_INPUT`
* `INVALID_CONTEXT`

## Non-applied failure codes

* None

## Raw schemas

> [accordion] Raw input schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "includeText": {
>       "type": "boolean"
>     }
>   },
>   "type": "object"
> }
> ```

> [accordion] Raw output schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "activeChangeIds": {
>       "items": {
>         "type": "string"
>       },
>       "type": "array"
>     },
>     "activeCommentIds": {
>       "items": {
>         "type": "string"
>       },
>       "type": "array"
>     },
>     "activeMarks": {
>       "items": {
>         "type": "string"
>       },
>       "type": "array"
>     },
>     "empty": {
>       "type": "boolean"
>     },
>     "target": {
>       "oneOf": [
>         {
>           "$ref": "#/$defs/TextTarget"
>         },
>         {
>           "type": "null"
>         }
>       ]
>     },
>     "text": {
>       "type": "string"
>     }
>   },
>   "required": [
>     "empty",
>     "target",
>     "activeMarks",
>     "activeCommentIds",
>     "activeChangeIds"
>   ],
>   "type": "object"
> }
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.