---
title: "InsertTextCmd | Customer's Canvas On-Premises"
canonical: "https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/InsertTextCmd/"
---

# InsertTextCmd

> The command to insert plain text relative to the current cursor position.

## Classes

### InsertTextCmd

#### Remarks

if there is selected text, it will be deleted.

#### Implements

- [`ICommand`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ICommand.md#icommand)

#### Constructors

##### Constructor

```ts
new InsertTextCmd(textManager, initData): InsertTextCmd;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `textManager` | [`ITextManager`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ITextManager.md#itextmanager) |
| `initData` | [`InsertTextCmdData`](#inserttextcmddata) |

###### Returns

[`InsertTextCmd`](#inserttextcmd)

#### Accessors

##### text

###### Get Signature

```ts
get text(): string;
```

###### Returns

`string`

#### Methods

##### execute()

```ts
execute(): boolean;
```

Executes the command.

###### Returns

`boolean`

true if changes were made, false otherwise.

###### Implementation of

[`ICommand`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ICommand.md#icommand).[`execute`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ICommand.md#execute)

***

### InsertTextCmdData

Data required to initialize the command.

#### Constructors

##### Constructor

```ts
new InsertTextCmdData(text, isNewLineEnabled): InsertTextCmdData;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `text` | `string` |
| `isNewLineEnabled` | `boolean` |

###### Returns

[`InsertTextCmdData`](#inserttextcmddata)

#### Properties

##### isNewLineEnabled

```ts
isNewLineEnabled: boolean;
```

Indicates that new line insertion is enabled.

##### text

```ts
text: string;
```

Text for insert.
