Skip to main content
Alpha: Document API is currently alpha and subject to breaking changes.

Summary

Check whether two adjacent list sequences can be joined.
  • Operation ID: lists.canJoin
  • API member path: editor.doc.lists.canJoin(...)
  • Mutates document: no
  • Idempotency: idempotent
  • Supports tracked mode: no
  • Supports dry run: no
  • Deterministic target resolution: yes

Expected result

Returns a ListsCanJoinResult indicating feasibility and reason if not possible.

Input fields

FieldTypeRequiredDescription
directionenumyes"withPrevious", "withNext"
targetListItemAddressyesListItemAddress
target.kind"block"yesConstant: "block"
target.nodeIdstringyes
target.nodeType"listItem"yesConstant: "listItem"

Example request

{
  "direction": "withPrevious",
  "target": {
    "kind": "block",
    "nodeId": "node-def456",
    "nodeType": "listItem"
  }
}

Output fields

FieldTypeRequiredDescription
adjacentListIdstringno
canJoinbooleanyes
reasonenumno"NO_ADJACENT_SEQUENCE", "INCOMPATIBLE_DEFINITIONS", "ALREADY_SAME_SEQUENCE"

Example response

{
  "adjacentListId": "example",
  "canJoin": true,
  "reason": "NO_ADJACENT_SEQUENCE"
}

Pre-apply throws

  • TARGET_NOT_FOUND
  • INVALID_TARGET
  • INVALID_INPUT

Non-applied failure codes

  • None

Raw schemas

{
  "additionalProperties": false,
  "properties": {
    "direction": {
      "enum": [
        "withPrevious",
        "withNext"
      ]
    },
    "target": {
      "$ref": "#/$defs/ListItemAddress"
    }
  },
  "required": [
    "target",
    "direction"
  ],
  "type": "object"
}
{
  "additionalProperties": false,
  "properties": {
    "adjacentListId": {
      "type": "string"
    },
    "canJoin": {
      "type": "boolean"
    },
    "reason": {
      "enum": [
        "NO_ADJACENT_SEQUENCE",
        "INCOMPATIBLE_DEFINITIONS",
        "ALREADY_SAME_SEQUENCE"
      ]
    }
  },
  "required": [
    "canJoin"
  ],
  "type": "object"
}