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

Summary

Set or clear the fontFamily inline run property on the target text range.
  • Operation ID: format.fontFamily
  • API member path: editor.doc.format.fontFamily(...)
  • Mutates document: yes
  • Idempotency: conditional
  • Supports tracked mode: yes
  • 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

FieldTypeRequiredDescription
refstringno
targetSelectionTargetnoSelectionTarget
target.endSelectionPointnoSelectionPoint
target.kind"selection"noConstant: "selection"
target.startSelectionPointnoSelectionPoint
valuestring \nullyesOne of: string, null

Example request

{
  "target": {
    "end": {
      "blockId": "block-abc123",
      "kind": "text",
      "offset": 0
    },
    "kind": "selection",
    "start": {
      "blockId": "block-abc123",
      "kind": "text",
      "offset": 0
    }
  },
  "value": "example"
}

Output fields

Variant 1 (resolution.requestedTarget.kind=“text”)

FieldTypeRequiredDescription
insertedEntityAddress[]no
removedEntityAddress[]no
resolutionTextMutationResolutionyesTextMutationResolution
resolution.rangeTextMutationRangeyesTextMutationRange
resolution.range.fromintegeryes
resolution.range.tointegeryes
resolution.requestedTargetTextAddressnoTextAddress
resolution.requestedTarget.blockIdstringno
resolution.requestedTarget.kind"text"noConstant: "text"
resolution.requestedTarget.rangeRangenoRange
resolution.requestedTarget.range.endintegerno
resolution.requestedTarget.range.startintegerno
resolution.selectionTargetSelectionTargetnoSelectionTarget
resolution.selectionTarget.endSelectionPointnoSelectionPoint
resolution.selectionTarget.kind"selection"noConstant: "selection"
resolution.selectionTarget.startSelectionPointnoSelectionPoint
resolution.targetTextAddressyesTextAddress
resolution.target.blockIdstringyes
resolution.target.kind"text"yesConstant: "text"
resolution.target.rangeRangeyesRange
resolution.target.range.endintegeryes
resolution.target.range.startintegeryes
resolution.textstringyes
successtrueyesConstant: true
updatedEntityAddress[]no

Variant 2 (resolution.requestedTarget.kind=“text”)

FieldTypeRequiredDescription
failureobjectyes
failure.codeenumyes"INVALID_TARGET"
failure.detailsanyno
failure.messagestringyes
resolutionTextMutationResolutionyesTextMutationResolution
resolution.rangeTextMutationRangeyesTextMutationRange
resolution.range.fromintegeryes
resolution.range.tointegeryes
resolution.requestedTargetTextAddressnoTextAddress
resolution.requestedTarget.blockIdstringno
resolution.requestedTarget.kind"text"noConstant: "text"
resolution.requestedTarget.rangeRangenoRange
resolution.requestedTarget.range.endintegerno
resolution.requestedTarget.range.startintegerno
resolution.selectionTargetSelectionTargetnoSelectionTarget
resolution.selectionTarget.endSelectionPointnoSelectionPoint
resolution.selectionTarget.kind"selection"noConstant: "selection"
resolution.selectionTarget.startSelectionPointnoSelectionPoint
resolution.targetTextAddressyesTextAddress
resolution.target.blockIdstringyes
resolution.target.kind"text"yesConstant: "text"
resolution.target.rangeRangeyesRange
resolution.target.range.endintegeryes
resolution.target.range.startintegeryes
resolution.textstringyes
successfalseyesConstant: 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
      }
    },
    "selectionTarget": {
      "end": {
        "blockId": "block-abc123",
        "kind": "text",
        "offset": 0
      },
      "kind": "selection",
      "start": {
        "blockId": "block-abc123",
        "kind": "text",
        "offset": 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_FOUND
  • CAPABILITY_UNAVAILABLE
  • INVALID_TARGET
  • INVALID_INPUT

Non-applied failure codes

  • INVALID_TARGET

Raw schemas

{
  "allOf": [
    {
      "$ref": "#/$defs/TargetLocator"
    },
    {
      "additionalProperties": false,
      "properties": {
        "value": {
          "oneOf": [
            {
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "value"
      ],
      "type": "object"
    }
  ]
}
{
  "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"
    }
  ]
}
{
  "$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"
}