# EditTextToolApi.cancel()

```ts
cancel(): Promise<void>
```

Discards every pending edit — the one way to: leaving the tool by any other means writes them. Deactivates the tool, as pressing Escape in the toolbar does.

- Kind: method
- Since: 1.0.0

Returns `Promise<void>`: Resolves once discarded.

Throws:

- `INVALID_STATE` while the tool is not active — without `edit-text` it cannot be activated.

```ts
await viewer.tools.editText.cancel();
```

Part of [EditTextToolApi](https://kernstra.com/docs/web-sdk/api/viewer-tools-edittext) in the Kernstra Web SDK 1.0.0 API reference.

Web page: https://kernstra.com/docs/web-sdk/api/viewer-tools-edittext/cancel
