---
title: "text.edit: Edit Type — Photo kit command — Kition"
description: "Replaces or edits the text of type layer `layer` (else the active one), keeping its styles."
canonical: "https://developer.kition.ai/docs/kits/photo/commands/text.edit"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/photo/commands/text.edit](https://developer.kition.ai/docs/kits/photo/commands/text.edit)

# text.edit

**Edit Type.** Replaces or edits the text of type layer `layer` (else the active one), keeping its styles.

- Kit: Photo 0.1.0 (PSD, PSB, or .kphoto); reference: [Photo kit commands](https://developer.kition.ai/docs/kits/photo.md)
- Changes the document: yes
- Acts on: `layer` (one id), which a run step’s `on` fills

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `antialias` | `"none" \| "sharp" \| "crisp" \| "strong" \| "smooth"` | no |  |
| `box` | `number[]` | no | to paragraph text |
| `coalesce` | `string` | no | Merges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one. |
| `kernPair` | `object` | no | {"at":caretChar,"by":1/1000em}? (Alt+←/→: the pair before the caret becomes manual, its current kerning + by); Alt+←/→: the pair before the caret becomes manual, its current kerning + by |
| `kerning` | `any` | no | 1/1000em\|"metrics"\|"optical"\|"off"? (with "range":[startChar,endChar]?, default all); with "range":[startChar,endChar]?, default all |
| `layer` | `integer \| string` | no | The layer: its id as inspect lists it, "#n" (the n-th layer of the image's top level as inspect lists it, counted from the top: "#1" is the top one), or its whole name when no other layer has it; the active layer by default. |
| `move` | `number[]` | no | [dx, dy] |
| `name` | `string` | no |  |
| `point` | `number[]` | no | to point text |
| `replace` | `object` | no | {"start":char,"end":char,"text":str}? |
| `runs` | `object[]` | no | [{"start":char,"end":char,…character keys}]? |
| `text` | `string` | no | replace all, styles kept |
| `transform` | `number[]` | no | [a, b, c, d, e, f] |

## Call through photo_run

```text
photo_run {
  "path": "<file>.psd",
  "steps": [{ "command": "text.edit" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `antialias`, `box`, `coalesce`, `kernPair`, `kerning`, `layer`, `move`, `name`, `point`, `replace`, `runs`, `text`, `transform`. photo_run answers the step’s result in `completed[i].result`.

## Result

The kit gives no result schema for this command.

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "antialias": {
      "enum": [
        "none",
        "sharp",
        "crisp",
        "strong",
        "smooth"
      ],
      "type": "string"
    },
    "box": {
      "description": "to paragraph text",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "coalesce": {
      "description": "Merges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one.",
      "type": "string"
    },
    "kernPair": {
      "additionalProperties": true,
      "description": "{\"at\":caretChar,\"by\":1/1000em}? (Alt+←/→: the pair before the caret becomes manual, its current kerning + by); Alt+←/→: the pair before the caret becomes manual, its current kerning + by",
      "properties": {
        "at": {
          "description": "caretChar"
        },
        "by": {
          "description": "1/1000em"
        }
      },
      "type": "object"
    },
    "kerning": {
      "description": "1/1000em|\"metrics\"|\"optical\"|\"off\"? (with \"range\":[startChar,endChar]?, default all); with \"range\":[startChar,endChar]?, default all"
    },
    "layer": {
      "description": "The layer: its id as inspect lists it, \"#n\" (the n-th layer of the image's top level as inspect lists it, counted from the top: \"#1\" is the top one), or its whole name when no other layer has it; the active layer by default.",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ],
      "x-khp-index": "#",
      "x-khp-index-order": "reversed",
      "x-khp-name": "name",
      "x-khp-types": [
        "Layer"
      ]
    },
    "move": {
      "description": "[dx, dy]",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "name": {
      "type": "string"
    },
    "point": {
      "description": "to point text",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "replace": {
      "additionalProperties": true,
      "description": "{\"start\":char,\"end\":char,\"text\":str}?",
      "properties": {
        "end": {
          "description": "char"
        },
        "start": {
          "description": "char"
        },
        "text": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "runs": {
      "description": "[{\"start\":char,\"end\":char,…character keys}]?",
      "items": {
        "additionalProperties": true,
        "properties": {
          "end": {
            "description": "char"
          },
          "start": {
            "description": "char"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "text": {
      "description": "replace all, styles kept",
      "type": "string"
    },
    "transform": {
      "description": "[a, b, c, d, e, f]",
      "items": {
        "type": "number"
      },
      "type": "array"
    }
  },
  "returns": ": the pair before the caret becomes manual, its current kerning + by)}",
  "type": "object"
}
```

Generated from the command list of @kition/photo-darwin-arm64@0.1.0 and the kit itself (photo_commands through @kition/cli@0.1.1, built from KitionAI/kition-photo@abe3f30).
