---
title: "ImageEditor"
---
# ImageEditor

Defined in: [src/modules/image-editor/image-editor.ts:107](https://github.com/xdan/jodit/blob/main/src/modules/image-editor/image-editor.ts#L107)

The module allows you to edit the image: resize or cut any part of it

## Extends

- [`ViewComponent`](./component.ViewComponent.html)\<[`IViewWithToolbar`](../interfaces/types.IViewWithToolbar.html) & [`IDlgs`](../interfaces/types.IDlgs.html)\>

### Constructor

**new ImageEditor**(`editor`): `ImageEditor`

Defined in: [src/modules/image-editor/image-editor.ts:773](https://github.com/xdan/jodit/blob/main/src/modules/image-editor/image-editor.ts#L773)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `editor` | [`IViewWithToolbar`](../interfaces/types.IViewWithToolbar.html)\<[`IViewOptions`](../interfaces/types.IViewOptions.html)\> & [`IDlgs`](../interfaces/types.IDlgs.html) |

#### Returns

`ImageEditor`

#### Overrides

[`ViewComponent`](./component.ViewComponent.html).[`constructor`](./component.ViewComponent.html#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

[`ViewComponent`](./component.ViewComponent.html).[`STATUSES`](./component.ViewComponent.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)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`async`](./component.ViewComponent.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)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`uid`](./component.ViewComponent.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

#### Inherited from

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

***

### jodit

**jodit**: [`IViewWithToolbar`](../interfaces/types.IViewWithToolbar.html)\<[`IViewOptions`](../interfaces/types.IViewOptions.html)\> & [`IDlgs`](../interfaces/types.IDlgs.html)

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

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`jodit`](./component.ViewComponent.html#jodit)

***

### options

**options**: [`ImageEditorOptions`](../interfaces/types.ImageEditorOptions.html)

Defined in: [src/modules/image-editor/image-editor.ts:113](https://github.com/xdan/jodit/blob/main/src/modules/image-editor/image-editor.ts#L113)

#### 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`

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`componentName`](./component.ViewComponent.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)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`ownerDocument`](./component.ViewComponent.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)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`od`](./component.ViewComponent.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)

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`ow`](./component.ViewComponent.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`

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`isReady`](./component.ViewComponent.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`

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`isDestructed`](./component.ViewComponent.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`

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`isInDestruct`](./component.ViewComponent.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`

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`componentStatus`](./component.ViewComponent.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`

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`j`](./component.ViewComponent.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`

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`defaultTimeout`](./component.ViewComponent.html#defaulttimeout)

***

#### Get Signature

**get** **o**(): `this`\[`"options"`\]

Defined in: [src/modules/image-editor/image-editor.ts:114](https://github.com/xdan/jodit/blob/main/src/modules/image-editor/image-editor.ts#L114)

##### Returns

`this`\[`"options"`\]

#### 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`

##### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`getFullElName`](./component.ViewComponent.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`

##### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`getFullElName`](./component.ViewComponent.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`

##### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`getFullElName`](./component.ViewComponent.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
```

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`get`](./component.ViewComponent.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`

#### Inherited from

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

***

### 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

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`setStatus`](./component.ViewComponent.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`

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`hookStatus`](./component.ViewComponent.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

[`ViewComponent`](./component.ViewComponent.html).[`isInstanceOf`](./component.ViewComponent.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`

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`i18n`](./component.ViewComponent.html#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` | [`IViewWithToolbar`](../interfaces/types.IViewWithToolbar.html)\<[`IViewOptions`](../interfaces/types.IViewOptions.html)\> & [`IDlgs`](../interfaces/types.IDlgs.html) |

#### Returns

`this`

#### Inherited from

[`ViewComponent`](./component.ViewComponent.html).[`setParentView`](./component.ViewComponent.html#setparentview)

***

### className()

**className**(): `string`

Defined in: [src/modules/image-editor/image-editor.ts:109](https://github.com/xdan/jodit/blob/main/src/modules/image-editor/image-editor.ts#L109)

#### Returns

`string`

#### Overrides

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

***

### hide()

**hide**(): `void`

Defined in: [src/modules/image-editor/image-editor.ts:129](https://github.com/xdan/jodit/blob/main/src/modules/image-editor/image-editor.ts#L129)

Hide image editor

#### Returns

`void`

***

### open()

**open**(`url`, `save`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`IDialog`](../interfaces/types.IDialog.html)\>

Defined in: [src/modules/image-editor/image-editor.ts:158](https://github.com/xdan/jodit/blob/main/src/modules/image-editor/image-editor.ts#L158)

Open image editor

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `url` | `string` |
| `save` | `onSave` |

#### Returns

[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`IDialog`](../interfaces/types.IDialog.html)\>

#### Example

```javascript
const jodit = Jodit.make('.editor', {
     imageeditor: {
         crop: false,
         closeAfterSave: true,
         width: 500
     }
});
jodit.imageeditor.open('https://xdsoft.net/jodit/images/test.png', function (name, data, success, failed) {
     var img = jodit.node.c('img');
     img.setAttribute('src', 'https://xdsoft.net/jodit/images/test.png');
     if (box.action !== 'resize') {
          return failed('Sorry it is work only in resize mode. For croping use FileBrowser');
     }
     img.style.width = data.w;
     img.style.height = data.h;
     jodit.s.insertNode(img);
     success();
});
```

***

### destruct()

**destruct**(): `any`

Defined in: [src/modules/image-editor/image-editor.ts:849](https://github.com/xdan/jodit/blob/main/src/modules/image-editor/image-editor.ts#L849)

#### Returns

`any`

#### Overrides

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