---
title: "ViewComponent"
---
# ViewComponent

Defined in: [src/core/component/view-component.ts:15](https://github.com/xdan/jodit/blob/main/src/core/component/view-component.ts#L15)

The base class of all Jodit UI components. Provides work with a life cycle.

## Extends

- [`Component`](./component.Component.html)

## Extended by

- [`Plugin`](./plugin.Plugin.html)
- [`UIElement`](./ui.UIElement.html)
- [`History`](./history.History.html)
- [`Snapshot`](./history.Snapshot.html)
- [`ImageEditor`](./image_editor.ImageEditor.html)
- [`StatusBar`](./status_bar.StatusBar.html)
- [`Table`](./table.Table.html)
- [`Uploader`](./uploader.Uploader.html)

## Type Parameters

| Type Parameter | Default type |
| ------ | ------ |
| `T` *extends* [`IViewBased`](../interfaces/types.IViewBased.html) | [`IViewBased`](../interfaces/types.IViewBased.html) |

## Implements

- [`IViewComponent`](../interfaces/types.IViewComponent.html)\<`T`\>

### Constructor

**new ViewComponent**\<`T`\>(`jodit`): `ViewComponent`\<`T`\>

Defined in: [src/core/component/view-component.ts:59](https://github.com/xdan/jodit/blob/main/src/core/component/view-component.ts#L59)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `jodit` | `T` |

#### Returns

`ViewComponent`\<`T`\>

#### Overrides

`Component.constructor`

### STATUSES

`static` **STATUSES**: `object`

Defined in: [src/core/component/component.ts:40](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L40)

#### beforeInit

`readonly` **beforeInit**: `"beforeInit"` = `'beforeInit'`

#### ready

`readonly` **ready**: `"ready"` = `'ready'`

#### beforeDestruct

`readonly` **beforeDestruct**: `"beforeDestruct"` = `'beforeDestruct'`

#### destructed

`readonly` **destructed**: `"destructed"` = `'destructed'`

#### Inherited from

[`Component`](./component.Component.html).[`STATUSES`](./component.Component.html#statuses)

***

### async

**async**: [`IAsync`](../interfaces/types.IAsync.html)

Defined in: [src/core/component/component.ts:44](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L44)

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`async`](../interfaces/types.IViewComponent.html#async)

#### Inherited from

[`Component`](./component.Component.html).[`async`](./component.Component.html#async)

***

### uid

`readonly` **uid**: `string`

Defined in: [src/core/component/component.ts:59](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L59)

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`uid`](../interfaces/types.IViewComponent.html#uid)

#### Inherited from

[`Component`](./component.Component.html).[`uid`](./component.Component.html#uid)

***

### ownerWindow

**ownerWindow**: [`Window`](https://developer.mozilla.org/docs/Web/API/Window) = `window`

Defined in: [src/core/component/component.ts:109](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L109)

The window in which jodit was created

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`ownerWindow`](../interfaces/types.IViewComponent.html#ownerwindow)

#### Inherited from

[`Component`](./component.Component.html).[`ownerWindow`](./component.Component.html#ownerwindow)

***

### jodit

**jodit**: `T`

Defined in: [src/core/component/view-component.ts:22](https://github.com/xdan/jodit/blob/main/src/core/component/view-component.ts#L22)

Parent View element

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`jodit`](../interfaces/types.IViewComponent.html#jodit)

#### Get Signature

**get** **componentName**(): `string`

Defined in: [src/core/component/component.ts:46](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L46)

##### Returns

`string`

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`componentName`](../interfaces/types.IViewComponent.html#componentname)

#### Inherited from

[`Component`](./component.Component.html).[`componentName`](./component.Component.html#componentname)

***

#### Get Signature

**get** **ownerDocument**(): [`Document`](https://developer.mozilla.org/docs/Web/API/Document)

Defined in: [src/core/component/component.ts:95](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L95)

The document in which jodit was created

##### Returns

[`Document`](https://developer.mozilla.org/docs/Web/API/Document)

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`ownerDocument`](../interfaces/types.IViewComponent.html#ownerdocument)

#### Inherited from

[`Component`](./component.Component.html).[`ownerDocument`](./component.Component.html#ownerdocument)

***

#### Get Signature

**get** **od**(): [`Document`](https://developer.mozilla.org/docs/Web/API/Document)

Defined in: [src/core/component/component.ts:102](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L102)

Shortcut for `this.ownerDocument`

##### Returns

[`Document`](https://developer.mozilla.org/docs/Web/API/Document)

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`od`](../interfaces/types.IViewComponent.html#od)

#### Inherited from

[`Component`](./component.Component.html).[`od`](./component.Component.html#od)

***

#### Get Signature

**get** **ow**(): [`Window`](https://developer.mozilla.org/docs/Web/API/Window)

Defined in: [src/core/component/component.ts:110](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L110)

##### Returns

[`Window`](https://developer.mozilla.org/docs/Web/API/Window)

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`ow`](../interfaces/types.IViewComponent.html#ow)

#### Inherited from

[`Component`](./component.Component.html).[`ow`](./component.Component.html#ow)

***

#### Get Signature

**get** **isReady**(): `boolean`

Defined in: [src/core/component/component.ts:145](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L145)

Component is ready for work

##### Returns

`boolean`

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`isReady`](../interfaces/types.IViewComponent.html#isready)

#### Inherited from

[`Component`](./component.Component.html).[`isReady`](./component.Component.html#isready)

***

#### Get Signature

**get** **isDestructed**(): `boolean`

Defined in: [src/core/component/component.ts:152](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L152)

Component was destructed

##### Returns

`boolean`

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`isDestructed`](../interfaces/types.IViewComponent.html#isdestructed)

#### Inherited from

[`Component`](./component.Component.html).[`isDestructed`](./component.Component.html#isdestructed)

***

#### Get Signature

**get** **isInDestruct**(): `boolean`

Defined in: [src/core/component/component.ts:160](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L160)

The component is currently undergoing destructuring or has already been destroyed.
Those. you should not the app froze new events on him now or do anything else with him.

##### Returns

`boolean`

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`isInDestruct`](../interfaces/types.IViewComponent.html#isindestruct)

#### Inherited from

[`Component`](./component.Component.html).[`isInDestruct`](./component.Component.html#isindestruct)

***

#### Get Signature

**get** **componentStatus**(): [`ComponentStatus`](../modules/types.html#componentstatus)

Defined in: [src/core/component/component.ts:210](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L210)

Current component status

##### Returns

[`ComponentStatus`](../modules/types.html#componentstatus)

#### Set Signature

**set** **componentStatus**(`componentStatus`): `void`

Defined in: [src/core/component/component.ts:217](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L217)

Setter for current component status

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `componentStatus` | [`ComponentStatus`](../modules/types.html#componentstatus) |

##### Returns

`void`

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`componentStatus`](../interfaces/types.IViewComponent.html#componentstatus)

#### Inherited from

[`Component`](./component.Component.html).[`componentStatus`](./component.Component.html#componentstatus)

***

#### Get Signature

**get** **j**(): `T`

Defined in: [src/core/component/view-component.ts:27](https://github.com/xdan/jodit/blob/main/src/core/component/view-component.ts#L27)

Shortcut for `this.jodit`

##### Returns

`T`

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`j`](../interfaces/types.IViewComponent.html#j)

***

#### Get Signature

**get** **defaultTimeout**(): `number`

Defined in: [src/core/component/view-component.ts:31](https://github.com/xdan/jodit/blob/main/src/core/component/view-component.ts#L31)

##### Returns

`number`

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`defaultTimeout`](../interfaces/types.IViewComponent.html#defaulttimeout)

#### Call Signature

**getFullElName**(`elementName`): `string`

Defined in: [src/core/component/component.ts:65](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L65)

Calc BEM element class name

##### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `elementName` | `string` | element name in the bem classification |

##### Returns

`string`

##### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`getFullElName`](../interfaces/types.IViewComponent.html#getfullelname)

##### Inherited from

[`Component`](./component.Component.html).[`getFullElName`](./component.Component.html#getfullelname)

#### Call Signature

**getFullElName**(`elementName`, `mod`): `string`

Defined in: [src/core/component/component.ts:66](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L66)

Calc BEM element class name

##### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `elementName` | `string` | element name in the bem classification |
| `mod` | `string` | - |

##### Returns

`string`

##### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`getFullElName`](../interfaces/types.IViewComponent.html#getfullelname)

##### Inherited from

[`Component`](./component.Component.html).[`getFullElName`](./component.Component.html#getfullelname)

#### Call Signature

**getFullElName**(`elementName`, `mod`, `modValue`): `string`

Defined in: [src/core/component/component.ts:67](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L67)

Calc BEM element class name

##### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `elementName` | `string` | element name in the bem classification |
| `mod` | `string` | - |
| `modValue` | `string` \| `boolean` | - |

##### Returns

`string`

##### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`getFullElName`](../interfaces/types.IViewComponent.html#getfullelname)

##### Inherited from

[`Component`](./component.Component.html).[`getFullElName`](./component.Component.html#getfullelname)

***

### get()

**get**\<`T`\>(`chain`, `obj?`): [`Nullable`](../modules/types.html#nullable)\<`T`\>

Defined in: [src/core/component/component.ts:138](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L138)

Safe get any field

#### Type Parameters

| Type Parameter |
| ------ |
| `T` |

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `chain` | `string` | the path to be traversed in the obj object |
| `obj?` | [`IDictionary`](../modules/types.html#idictionary) | the object in which the value is searched |

#### Returns

[`Nullable`](../modules/types.html#nullable)\<`T`\>

#### Example

```js
private a = {
  b: {
    c: {
      e: {
        g: {
          color: 'red'
        }
      }
    }
  }
}

this.get('a.b.c.e.g.color'); // Safe access to color
// instead using optionsl chaining
this?.a?.b?.c?.e?.g?.color
```

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`get`](../interfaces/types.IViewComponent.html#get)

#### Inherited from

[`Component`](./component.Component.html).[`get`](./component.Component.html#get)

***

### bindDestruct()

**bindDestruct**(`component`): `this`

Defined in: [src/core/component/component.ts:170](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L170)

Bind destructor to some View

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `component` | [`IComponent`](../interfaces/types.IComponent.html) |

#### Returns

`this`

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`bindDestruct`](../interfaces/types.IViewComponent.html#binddestruct)

#### Inherited from

[`Component`](./component.Component.html).[`bindDestruct`](./component.Component.html#binddestruct)

***

### className()

`abstract` **className**(): `string`

Defined in: [src/core/component/component.ts:179](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L179)

#### Returns

`string`

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`className`](../interfaces/types.IViewComponent.html#classname)

#### Inherited from

[`Component`](./component.Component.html).[`className`](./component.Component.html#classname)

***

### setStatus()

**setStatus**(`componentStatus`): `void`

Defined in: [src/core/component/component.ts:226](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L226)

Set component status

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `componentStatus` | [`ComponentStatus`](../modules/types.html#componentstatus) | component status |

#### Returns

`void`

#### See

ComponentStatus

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`setStatus`](../interfaces/types.IViewComponent.html#setstatus)

#### Inherited from

[`Component`](./component.Component.html).[`setStatus`](./component.Component.html#setstatus)

***

### hookStatus()

**hookStatus**(`status`, `callback`): `void`

Defined in: [src/core/component/component.ts:265](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L265)

Adds a handler for changing the component's status

#### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `status` | [`ComponentStatus`](../modules/types.html#componentstatus) | the status at which the callback is triggered |
| `callback` | (`component`) => `void` | a function that will be called when the status is `status` |

#### Returns

`void`

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`hookStatus`](../interfaces/types.IViewComponent.html#hookstatus)

#### Inherited from

[`Component`](./component.Component.html).[`hookStatus`](./component.Component.html#hookstatus)

***

### isInstanceOf()

`static` **isInstanceOf**\<`T`\>(`c`, `constructorFunc`): `c is T`

Defined in: [src/core/component/component.ts:283](https://github.com/xdan/jodit/blob/main/src/core/component/component.ts#L283)

#### Type Parameters

| Type Parameter |
| ------ |
| `T` *extends* [`Component`](./component.Component.html) |

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `c` | `unknown` |
| `constructorFunc` | [`Function`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function) |

#### Returns

`c is T`

#### Inherited from

[`Component`](./component.Component.html).[`isInstanceOf`](./component.Component.html#isinstanceof)

***

### i18n()

**i18n**(`text`, ...`params`): `string`

Defined in: [src/core/component/view-component.ts:35](https://github.com/xdan/jodit/blob/main/src/core/component/view-component.ts#L35)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `text` | `string` |
| ...`params` | (`string` \| `number`)[] |

#### Returns

`string`

#### Implementation of

`IViewComponent.i18n`

***

### setParentView()

**setParentView**(`jodit`): `this`

Defined in: [src/core/component/view-component.ts:42](https://github.com/xdan/jodit/blob/main/src/core/component/view-component.ts#L42)

Attach component to View

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `jodit` | `T` |

#### Returns

`this`

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`setParentView`](../interfaces/types.IViewComponent.html#setparentview)

***

### destruct()

**destruct**(): `any`

Defined in: [src/core/component/view-component.ts:65](https://github.com/xdan/jodit/blob/main/src/core/component/view-component.ts#L65)

#### Returns

`any`

#### Implementation of

[`IViewComponent`](../interfaces/types.IViewComponent.html).[`destruct`](../interfaces/types.IViewComponent.html#destruct)

#### Overrides

[`Component`](./component.Component.html).[`destruct`](./component.Component.html#destruct)
