> ## Documentation Index
> Fetch the complete documentation index at: https://superdoc-caio-pizzol-docs-ai-core-preset.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# format.paragraph.setKeepOptions

> Set keep-with-next, keep-lines-together, and widow/orphan control flags.

## Summary

Set keep-with-next, keep-lines-together, and widow/orphan control flags.

* Operation ID: `format.paragraph.setKeepOptions`
* API member path: `editor.doc.format.paragraph.setKeepOptions(...)`
* Mutates document: `yes`
* Idempotency: `conditional`
* Supports tracked mode: `no`
* Supports dry run: `yes`
* Deterministic target resolution: `yes`

## Expected result

Returns a ParagraphMutationResult; reports NO\_OP if all flags already match.

## Input fields

### Variant 1 (required: keepNext)

| Field      | Type                                                  | Required | Description                                               |
| ---------- | ----------------------------------------------------- | -------- | --------------------------------------------------------- |
| `keepNext` | boolean                                               | yes      |                                                           |
| `target`   | ParagraphAddress \| HeadingAddress \| ListItemAddress | yes      | One of: ParagraphAddress, HeadingAddress, ListItemAddress |

### Variant 2 (required: keepLines)

| Field       | Type                                                  | Required | Description                                               |
| ----------- | ----------------------------------------------------- | -------- | --------------------------------------------------------- |
| `keepLines` | boolean                                               | yes      |                                                           |
| `target`    | ParagraphAddress \| HeadingAddress \| ListItemAddress | yes      | One of: ParagraphAddress, HeadingAddress, ListItemAddress |

### Variant 3 (required: widowControl)

| Field          | Type                                                  | Required | Description                                               |
| -------------- | ----------------------------------------------------- | -------- | --------------------------------------------------------- |
| `target`       | ParagraphAddress \| HeadingAddress \| ListItemAddress | yes      | One of: ParagraphAddress, HeadingAddress, ListItemAddress |
| `widowControl` | boolean                                               | yes      |                                                           |

### Example request

```json theme={null}
{
  "keepNext": true,
  "target": {
    "kind": "block",
    "nodeId": "node-def456",
    "nodeType": "paragraph"
  }
}
```

## Output fields

### Variant 1 (success=true)

| Field               | Type                                                  | Required | Description                                               |
| ------------------- | ----------------------------------------------------- | -------- | --------------------------------------------------------- |
| `resolution`        | object                                                | yes      |                                                           |
| `resolution.target` | ParagraphAddress \| HeadingAddress \| ListItemAddress | yes      | One of: ParagraphAddress, HeadingAddress, ListItemAddress |
| `success`           | `true`                                                | yes      | Constant: `true`                                          |
| `target`            | ParagraphAddress \| HeadingAddress \| ListItemAddress | yes      | One of: ParagraphAddress, HeadingAddress, ListItemAddress |

### Variant 2 (success=false)

| Field               | Type                                                  | Required | Description                                               |
| ------------------- | ----------------------------------------------------- | -------- | --------------------------------------------------------- |
| `failure`           | object                                                | yes      |                                                           |
| `failure.code`      | enum                                                  | yes      | `"NO_OP"`                                                 |
| `failure.details`   | any                                                   | no       |                                                           |
| `failure.message`   | string                                                | yes      |                                                           |
| `resolution`        | object                                                | no       |                                                           |
| `resolution.target` | ParagraphAddress \| HeadingAddress \| ListItemAddress | no       | One of: ParagraphAddress, HeadingAddress, ListItemAddress |
| `success`           | `false`                                               | yes      | Constant: `false`                                         |

### Example response

```json theme={null}
{
  "resolution": {
    "target": {
      "kind": "block",
      "nodeId": "node-def456",
      "nodeType": "paragraph"
    }
  },
  "success": true,
  "target": {
    "kind": "block",
    "nodeId": "node-def456",
    "nodeType": "paragraph"
  }
}
```

## Pre-apply throws

* `TARGET_NOT_FOUND`
* `INVALID_TARGET`
* `CAPABILITY_UNAVAILABLE`

## Non-applied failure codes

* `NO_OP`

## Raw schemas

<Accordion title="Raw input schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "oneOf": [
      {
        "required": [
          "target",
          "keepNext"
        ]
      },
      {
        "required": [
          "target",
          "keepLines"
        ]
      },
      {
        "required": [
          "target",
          "widowControl"
        ]
      }
    ],
    "properties": {
      "keepLines": {
        "type": "boolean"
      },
      "keepNext": {
        "type": "boolean"
      },
      "target": {
        "oneOf": [
          {
            "$ref": "#/$defs/ParagraphAddress"
          },
          {
            "$ref": "#/$defs/HeadingAddress"
          },
          {
            "$ref": "#/$defs/ListItemAddress"
          }
        ]
      },
      "widowControl": {
        "type": "boolean"
      }
    },
    "required": [
      "target"
    ],
    "type": "object"
  }
  ```
</Accordion>

<Accordion title="Raw output schema">
  ```json theme={null}
  {
    "oneOf": [
      {
        "additionalProperties": false,
        "properties": {
          "resolution": {
            "additionalProperties": false,
            "properties": {
              "target": {
                "oneOf": [
                  {
                    "$ref": "#/$defs/ParagraphAddress"
                  },
                  {
                    "$ref": "#/$defs/HeadingAddress"
                  },
                  {
                    "$ref": "#/$defs/ListItemAddress"
                  }
                ]
              }
            },
            "required": [
              "target"
            ],
            "type": "object"
          },
          "success": {
            "const": true
          },
          "target": {
            "oneOf": [
              {
                "$ref": "#/$defs/ParagraphAddress"
              },
              {
                "$ref": "#/$defs/HeadingAddress"
              },
              {
                "$ref": "#/$defs/ListItemAddress"
              }
            ]
          }
        },
        "required": [
          "success",
          "target",
          "resolution"
        ],
        "type": "object"
      },
      {
        "additionalProperties": false,
        "properties": {
          "failure": {
            "additionalProperties": false,
            "properties": {
              "code": {
                "enum": [
                  "NO_OP"
                ]
              },
              "details": {},
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          },
          "resolution": {
            "additionalProperties": false,
            "properties": {
              "target": {
                "oneOf": [
                  {
                    "$ref": "#/$defs/ParagraphAddress"
                  },
                  {
                    "$ref": "#/$defs/HeadingAddress"
                  },
                  {
                    "$ref": "#/$defs/ListItemAddress"
                  }
                ]
              }
            },
            "required": [
              "target"
            ],
            "type": "object"
          },
          "success": {
            "const": false
          }
        },
        "required": [
          "success",
          "failure"
        ],
        "type": "object"
      }
    ]
  }
  ```
</Accordion>

<Accordion title="Raw success schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "resolution": {
        "additionalProperties": false,
        "properties": {
          "target": {
            "oneOf": [
              {
                "$ref": "#/$defs/ParagraphAddress"
              },
              {
                "$ref": "#/$defs/HeadingAddress"
              },
              {
                "$ref": "#/$defs/ListItemAddress"
              }
            ]
          }
        },
        "required": [
          "target"
        ],
        "type": "object"
      },
      "success": {
        "const": true
      },
      "target": {
        "oneOf": [
          {
            "$ref": "#/$defs/ParagraphAddress"
          },
          {
            "$ref": "#/$defs/HeadingAddress"
          },
          {
            "$ref": "#/$defs/ListItemAddress"
          }
        ]
      }
    },
    "required": [
      "success",
      "target",
      "resolution"
    ],
    "type": "object"
  }
  ```
</Accordion>

<Accordion title="Raw failure schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "failure": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "enum": [
              "NO_OP"
            ]
          },
          "details": {},
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      },
      "resolution": {
        "additionalProperties": false,
        "properties": {
          "target": {
            "oneOf": [
              {
                "$ref": "#/$defs/ParagraphAddress"
              },
              {
                "$ref": "#/$defs/HeadingAddress"
              },
              {
                "$ref": "#/$defs/ListItemAddress"
              }
            ]
          }
        },
        "required": [
          "target"
        ],
        "type": "object"
      },
      "success": {
        "const": false
      }
    },
    "required": [
      "success",
      "failure"
    ],
    "type": "object"
  }
  ```
</Accordion>
