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

# CommandFactory

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

## Classes

### CommandFactory

#### Implements

#### Constructors

##### Constructor

```ts
new CommandFactory(
   textManager, 
   fontRegistry, 
   clipboard): CommandFactory;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `textManager` | [`ITextManager`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ITextManager.md#itextmanager) |
| `fontRegistry` | [`IFontRegistry`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IFontRegistry.md#ifontregistry) |
| `clipboard` | [`IClipboard`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IClipboard.md#iclipboard) |

###### Returns

[`CommandFactory`](#commandfactory)

#### Methods

##### create()

```ts
create(type, initData?): ICommand;
```

Creates a command of the required type.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `type` | [`CommandType`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/CommandType.md#commandtype) | command type. |
| `initData?` | `any` | data required to initialize the command. |

###### Returns

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

###### Implementation of

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

##### setFontRegistry()

```ts
setFontRegistry(fontRegistry): void;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `fontRegistry` | [`IFontRegistry`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IFontRegistry.md#ifontregistry) |

###### Returns

`void`
