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

# HtmlProcessor

> [`CommandKeys`](#commandkeys)

## Classes

### CommandKeys

#### Constructors

##### Constructor

```ts
new CommandKeys(): CommandKeys;
```

###### Returns

#### Properties

##### alignment

```ts
static alignment: string = "alignment";
```

##### allCaps

```ts
static allCaps: string = "all-caps";
```

##### bold

```ts
static bold: string = "bold";
```

##### color

```ts
static color: string = "color";
```

##### documentCommands

```ts
static documentCommands: CommandKeys[];
```

##### firstLineIndent

```ts
static firstLineIndent: string = "first-line-indent";
```

##### fontName

```ts
static fontName: string = "fontName";
```

##### fontSize

```ts
static fontSize: string = "fontSize";
```

##### italic

```ts
static italic: string = "italic";
```

##### justifyCenter

```ts
static justifyCenter: string = "justifyCenter";
```

##### justifyFull

```ts
static justifyFull: string = "justifyFull";
```

##### justifyLeft

```ts
static justifyLeft: string = "justifyLeft";
```

##### justifyRight

```ts
static justifyRight: string = "justifyRight";
```

##### leading

```ts
static leading: string = "leading";
```

##### leftIndent

```ts
static leftIndent: string = "left-indent";
```

##### openType

```ts
static openType: string = "open-type";
```

##### rightIndent

```ts
static rightIndent: string = "right-indent";
```

##### smallCaps

```ts
static smallCaps: string = "small-caps";
```

##### spaceAfter

```ts
static spaceAfter: string = "space-after";
```

##### spaceBefore

```ts
static spaceBefore: string = "space-before";
```

##### stroke

```ts
static stroke: string = "stroke";
```

##### subscript

```ts
static subscript: string = "subscript";
```

##### superscript

```ts
static superscript: string = "superscript";
```

##### tracking

```ts
static tracking: string = "tracking";
```

##### underline

```ts
static underline: string = "underline";
```

##### verticalAlignment

```ts
static verticalAlignment: string = "vertical-alignment";
```

##### verticalAlignmentBottom

```ts
static verticalAlignmentBottom: string = "verticalAlignmentBottom";
```

##### verticalAlignmentCenter

```ts
static verticalAlignmentCenter: string = "verticalAlignmentCenter";
```

##### verticalAlignmentTop

```ts
static verticalAlignmentTop: string = "verticalAlignmentTop";
```

***

### HtmlProcessor

#### Constructors

##### Constructor

```ts
new HtmlProcessor(): HtmlProcessor;
```

###### Returns

[`HtmlProcessor`](#htmlprocessor)

#### Properties

##### initData

```ts
static initData: EditorInitData;
```

#### Methods

##### applyCommands()

```ts
static applyCommands(
   element, 
   commands, 
   colorPalette, 
colorPreviewService): Promise<void>;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `element` | `HTMLElement` |
| `commands` | `Command`[] |
| `colorPalette` | `any` |
| `colorPreviewService` | [`IColorPreviewService`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IColorPreviewService.md#icolorpreviewservice) |

###### Returns

`Promise`\<`void`\>

##### customInlineCommand()

```ts
static customInlineCommand(
   commands, 
   range, 
   innerDiv, 
   colorPalette, 
colorPreviewService): Promise<void>;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `commands` | `Command`[] |
| `range` | `any` |
| `innerDiv` | `HTMLElement` |
| `colorPalette` | `any` |
| `colorPreviewService` | [`IColorPreviewService`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IColorPreviewService.md#icolorpreviewservice) |

###### Returns

`Promise`\<`void`\>

##### findAllSelectedLis()

```ts
static findAllSelectedLis(): HTMLElement[];
```

###### Returns

`HTMLElement`[]

##### getAdjacentLi()

```ts
static getAdjacentLi(liNodes): Element;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `liNodes` | `HTMLElement`[] |

###### Returns

`Element`

##### getCorrectLinesCount()

```ts
static getCorrectLinesCount(innerDiv): number;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `innerDiv` | `HTMLElement` |

###### Returns

`number`

##### getCurrentParagraphLength()

```ts
static getCurrentParagraphLength(paragraphOffset?): number;
```

###### Parameters

| Parameter | Type | Default value |
| ------ | ------ | ------ |
| `paragraphOffset` | `number` | `0` |

###### Returns

`number`

##### getDefaultFontValue()

```ts
static getDefaultFontValue(font): HtmlFontValue;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `font` | [IFontSettings](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-model/IFontSettings.md) |

###### Returns

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

##### getDefaultInlineStyle()

```ts
static getDefaultInlineStyle(style): ICharStyle;
```

###### Parameters

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

###### Returns

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

##### getEveryLineLength()

```ts
static getEveryLineLength(innerDiv): number[];
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `innerDiv` | `HTMLElement` |

###### Returns

`number`[]

##### getParagraphByIndex()

```ts
static getParagraphByIndex(index): Element;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `index` | `number` |

###### Returns

`Element`

##### getParagraphIndex()

```ts
static getParagraphIndex(paragraph): number;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `paragraph` | `Node` |

###### Returns

`number`

##### getParagraphLength()

```ts
static getParagraphLength(paragraph): number;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `paragraph` | `Node` |

###### Returns

`number`

##### getParagraphLengthByIndex()

```ts
static getParagraphLengthByIndex(index): number;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `index` | `number` |

###### Returns

`number`

##### insertTextAtCaret()

```ts
static insertTextAtCaret(text): void;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `text` | `string` |

###### Returns

`void`

##### isAnyList()

```ts
static isAnyList(e): boolean;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `e` | `Node` |

###### Returns

`boolean`

##### isBr()

```ts
static isBr(e): boolean;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `e` | `Node` |

###### Returns

`boolean`

##### isBulletedList()

```ts
static isBulletedList(e): boolean;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `e` | `Node` |

###### Returns

`boolean`

##### isCaretOnEndOfParagraph()

```ts
static isCaretOnEndOfParagraph(lineLength): boolean;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `lineLength` | `number` |

###### Returns

`boolean`

##### isCaretOnTheBeginingOfListItem()

```ts
static isCaretOnTheBeginingOfListItem(): boolean;
```

###### Returns

`boolean`

##### isCaretOnTheBeginingOfParagraph()

```ts
static isCaretOnTheBeginingOfParagraph(): boolean;
```

###### Returns

`boolean`

##### isListItem()

```ts
static isListItem(e): boolean;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `e` | `Node` |

###### Returns

`boolean`

##### isNumberedList()

```ts
static isNumberedList(e): boolean;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `e` | `Node` |

###### Returns

`boolean`

##### isParagraph()

```ts
static isParagraph(e): boolean;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `e` | `Node` |

###### Returns

`boolean`

##### isSpan()

```ts
static isSpan(e): boolean;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `e` | `Node` |

###### Returns

`boolean`

##### isText()

```ts
static isText(e): boolean;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `e` | `Node` |

###### Returns

`boolean`

##### paragraphStyleToCommands()

```ts
static paragraphStyleToCommands(value, useDocumentCommands?): Command[];
```

###### Parameters

| Parameter | Type | Default value |
| ------ | ------ | ------ |
| `value` | [`IParagraphStyle`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/IParagraphStyle.md#iparagraphstyle) | `undefined` |
| `useDocumentCommands` | `boolean` | `true` |

###### Returns

`Command`[]

##### processEnterOnEmptyListItem()

```ts
static processEnterOnEmptyListItem(e, innerDiv): void;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `e` | `KeyboardEvent` |
| `innerDiv` | `HTMLElement` |

###### Returns

`void`

##### saveSelection()

```ts
static saveSelection(context, offset?): () => void;
```

###### Parameters

| Parameter | Type | Default value |
| ------ | ------ | ------ |
| `context` | `Node` | `undefined` |
| `offset` | `number` | `0` |

###### Returns

() => `void`

##### setAdjacentLiStyle()

```ts
static setAdjacentLiStyle(liNodes, adjacentLi): void;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `liNodes` | `HTMLElement`[] |
| `adjacentLi` | `Element` |

###### Returns

`void`

##### setInitData()

```ts
static setInitData(data): void;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `data` | [`EditorInitData`](https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-text/ITextEditor.md#editorinitdata) |

###### Returns

`void`

##### setListStyle()

```ts
static setListStyle(liNodes, listType): void;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `liNodes` | `HTMLElement`[] |
| `listType` | `number` |

###### Returns

`void`

##### setPreviewScale()

```ts
static setPreviewScale(scale): void;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `scale` | `number` |

###### Returns

`void`

##### wrapSpansWithP()

```ts
static wrapSpansWithP(): void;
```

###### Returns

`void`
