Alpha: Document API is currently alpha and subject to breaking changes.
Summary
Set or clear thelang inline run property on the target text range.
- Operation ID:
format.lang - API member path:
editor.doc.format.lang(...) - Mutates document:
yes - Idempotency:
conditional - Supports tracked mode:
no - Supports dry run:
yes - Deterministic target resolution:
yes
Expected result
Returns a TextMutationReceipt confirming the inline run property patch was applied to the target range.Input fields
| Field | Type | Required | Description | |
|---|---|---|---|---|
target | TextAddress | yes | TextAddress | |
target.blockId | string | yes | ||
target.kind | "text" | yes | Constant: "text" | |
target.range | Range | yes | Range | |
target.range.end | integer | yes | ||
target.range.start | integer | yes | ||
value | object \ | null | yes | One of: object, null |
Example request
{
"target": {
"blockId": "block-abc123",
"kind": "text",
"range": {
"end": 10,
"start": 0
}
},
"value": {
"eastAsia": "example",
"val": "example"
}
}
Output fields
Variant 1 (resolution.requestedTarget.kind=“text”)
| Field | Type | Required | Description |
|---|---|---|---|
inserted | EntityAddress[] | no | |
removed | EntityAddress[] | no | |
resolution | TextMutationResolution | yes | TextMutationResolution |
resolution.range | TextMutationRange | yes | TextMutationRange |
resolution.range.from | integer | yes | |
resolution.range.to | integer | yes | |
resolution.requestedTarget | TextAddress | no | TextAddress |
resolution.requestedTarget.blockId | string | no | |
resolution.requestedTarget.kind | "text" | no | Constant: "text" |
resolution.requestedTarget.range | Range | no | Range |
resolution.requestedTarget.range.end | integer | no | |
resolution.requestedTarget.range.start | integer | no | |
resolution.target | TextAddress | yes | TextAddress |
resolution.target.blockId | string | yes | |
resolution.target.kind | "text" | yes | Constant: "text" |
resolution.target.range | Range | yes | Range |
resolution.target.range.end | integer | yes | |
resolution.target.range.start | integer | yes | |
resolution.text | string | yes | |
success | true | yes | Constant: true |
updated | EntityAddress[] | no |
Variant 2 (resolution.requestedTarget.kind=“text”)
| Field | Type | Required | Description |
|---|---|---|---|
failure | object | yes | |
failure.code | enum | yes | "INVALID_TARGET" |
failure.details | any | no | |
failure.message | string | yes | |
resolution | TextMutationResolution | yes | TextMutationResolution |
resolution.range | TextMutationRange | yes | TextMutationRange |
resolution.range.from | integer | yes | |
resolution.range.to | integer | yes | |
resolution.requestedTarget | TextAddress | no | TextAddress |
resolution.requestedTarget.blockId | string | no | |
resolution.requestedTarget.kind | "text" | no | Constant: "text" |
resolution.requestedTarget.range | Range | no | Range |
resolution.requestedTarget.range.end | integer | no | |
resolution.requestedTarget.range.start | integer | no | |
resolution.target | TextAddress | yes | TextAddress |
resolution.target.blockId | string | yes | |
resolution.target.kind | "text" | yes | Constant: "text" |
resolution.target.range | Range | yes | Range |
resolution.target.range.end | integer | yes | |
resolution.target.range.start | integer | yes | |
resolution.text | string | yes | |
success | false | yes | Constant: false |
Example response
{
"inserted": [
{
"entityId": "entity-789",
"entityType": "comment",
"kind": "entity"
}
],
"resolution": {
"range": {
"from": 0,
"to": 10
},
"requestedTarget": {
"blockId": "block-abc123",
"kind": "text",
"range": {
"end": 10,
"start": 0
}
},
"target": {
"blockId": "block-abc123",
"kind": "text",
"range": {
"end": 10,
"start": 0
}
},
"text": "Hello, world."
},
"success": true,
"updated": [
{
"entityId": "entity-789",
"entityType": "comment",
"kind": "entity"
}
]
}
Pre-apply throws
TARGET_NOT_FOUNDCAPABILITY_UNAVAILABLEINVALID_TARGETINVALID_INPUT
Non-applied failure codes
INVALID_TARGET
Raw schemas
Raw input schema
Raw input schema
{
"additionalProperties": false,
"properties": {
"target": {
"$ref": "#/$defs/TextAddress"
},
"value": {
"oneOf": [
{
"additionalProperties": false,
"minProperties": 1,
"properties": {
"bidi": {
"oneOf": [
{
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
]
},
"eastAsia": {
"oneOf": [
{
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
]
},
"val": {
"oneOf": [
{
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
]
}
},
"type": "object"
},
{
"type": "null"
}
]
}
},
"required": [
"target",
"value"
],
"type": "object"
}
Raw output schema
Raw output schema
{
"oneOf": [
{
"$ref": "#/$defs/TextMutationSuccess"
},
{
"additionalProperties": false,
"properties": {
"failure": {
"additionalProperties": false,
"properties": {
"code": {
"enum": [
"INVALID_TARGET"
]
},
"details": {},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object"
},
"resolution": {
"$ref": "#/$defs/TextMutationResolution"
},
"success": {
"const": false
}
},
"required": [
"success",
"failure",
"resolution"
],
"type": "object"
}
]
}
Raw success schema
Raw success schema
{
"$ref": "#/$defs/TextMutationSuccess"
}
Raw failure schema
Raw failure schema
{
"additionalProperties": false,
"properties": {
"failure": {
"additionalProperties": false,
"properties": {
"code": {
"enum": [
"INVALID_TARGET"
]
},
"details": {},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object"
},
"resolution": {
"$ref": "#/$defs/TextMutationResolution"
},
"success": {
"const": false
}
},
"required": [
"success",
"failure",
"resolution"
],
"type": "object"
}

