> ## Documentation Index
> Fetch the complete documentation index at: https://docs.supernote.com/llms.txt
> Use this file to discover all available pages before exploring further.

# modifyLassoText

> 修改套索文本框。

<Note>
  该接口支持笔记中的撤销还原操作。

  该接口修改的是套索的文本框数据，所以必须在套索文本框之后调用，
  而且是套索单个文本框。如果套索的不是文本框，或者套索多个文本框，调用会失败。
  所以建议在点击套索工具栏按钮后进入的插件界面调用该接口。
</Note>

```ts theme={null}
static modifyLassoText(textBox: {
  fontSize?: number;
  fontPath?: string;
  textContentFull: string;
  textRect: Rect;
  textDigestData?: string;
  textAlign?: number;
  textBold?: number;
  textItalics?: number;
  textFrameWidthType?: number;
  textFrameWidth?: number;
  textFrameStyle?: number;
  textEditable?: number;
}): Promise<APIResponse<boolean>>;
```

**参数**

| 参数                           | 类型                                                      | 说明               |
| ---------------------------- | ------------------------------------------------------- | ---------------- |
| `textBox.textContentFull`    | `string`                                                | 文本内容（必填，非空）      |
| `textBox.textRect`           | [`Rect`](/zh/api-reference/supernote-plugin/types/rect) | 文本框矩形（必填，需为非零面积） |
| `textBox.fontSize`           | `number`                                                | 字体大小（可选；需为正数）    |
| `textBox.fontPath`           | `string`                                                | 字体路径（可选）         |
| `textBox.textDigestData`     | `string`                                                | 摘要数据（可选）         |
| `textBox.textAlign`          | `number`                                                | 对齐方式（可选）         |
| `textBox.textBold`           | `number`                                                | 加粗（可选）           |
| `textBox.textItalics`        | `number`                                                | 斜体（可选）           |
| `textBox.textFrameWidthType` | `number`                                                | 边框宽度类型（可选）       |
| `textBox.textFrameWidth`     | `number`                                                | 边框宽度（可选）         |
| `textBox.textFrameStyle`     | `number`                                                | 边框样式（可选）         |
| `textBox.textEditable`       | `number`                                                | 是否可编辑（可选）        |

**返回**

* [`APIResponse<boolean>`](/zh/api-reference/supernote-plugin/types/api-response)：
  `result === true` 表示修改成功

## 示例

```ts wrap theme={null}
import { PluginNoteAPI, type TextBox } from 'sn-plugin-lib';

/**
 * 修改套索文本框的示例（读取后更新文本内容）。
 */
export async function exampleModifyLassoText() {
  const listRes = await PluginNoteAPI.getLassoText();
  if (!listRes.success) {
    throw new Error(listRes.error?.message ?? 'getLassoText 调用失败');
  }

  const textBoxes = (listRes.result ?? []) as TextBox[];
  const first = textBoxes[0];
  if (!first) {
    return false;
  }

  const res = await PluginNoteAPI.modifyLassoText({
    ...first,
    textContentFull: 'Updated by plugin',
  });

  if (!res.success) {
    throw new Error(res.error?.message ?? 'modifyLassoText 调用失败');
  }
  return res.result;
}
```
