# Editor

Editor

## Constructor

#### new Editor(element, configurationopt, themeopt, penStyleopt, behaviorsopt)

Source:
  - Editor.js, line 297

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`element` | `Element` |  | DOM element to attach this editor
`configuration` | `Configuration` | <optional> | Configuration to apply
`theme` | `Theme` | <optional> | Custom theme to apply
`penStyle` | `PenStyle` | <optional> | Custom style to apply
`behaviors` | `Behaviors` | <optional> | Custom behaviors to apply

### Classes

Editor

### Members

#### behavior

Get current behavior

Source:
  - Editor.js, line 511

#### behaviors

Get behaviors

Source:
  - Editor.js, line 479

#### canClear

True if can clear, false otherwise.

Source:
  - Editor.js, line 812

#### canConvert

True if can convert, false otherwise.

Source:
  - Editor.js, line 836

#### canExport

True if can export, false otherwise.

Source:
  - Editor.js, line 883

#### canRedo

True if can redo, false otherwise.

Source:
  - Editor.js, line 783

#### canUndo

True if can undo, false otherwise.

Source:
  - Editor.js, line 762

#### configuration

Set the recognition parameters WARNING : Need to fire a clear if user have already input some strokes.

Source:
  - Editor.js, line 375

#### configuration

Get the current recognition parameters

Source:
  - Editor.js, line 406

#### domElement :Element

Inner reference to the DOM Element

Source:
  - Editor.js, line 318

##### Type:

- `Element`

#### eastereggs

Get access to some easter egg features link ink injection. Use at your own risk (less tested and may be removed without notice).

Source:
  - Editor.js, line 981

#### emit

Get current events

Source:
  - Editor.js, line 640

#### exports

Get current state exports

Source:
  - Editor.js, line 930

#### exportTimer :Number

Launch export timer

Source:
  - Editor.js, line 335

##### Type:

- `Number`

#### grabber

Get current grabber

Source:
  - Editor.js, line 624

#### grabberContext :GrabberContext

Current grabber context

Source:
  - Editor.js, line 503

##### Type:

- `GrabberContext`

#### idle

True if idle state

Source:
  - Editor.js, line 745

#### initialized

True if initialized, false otherwise

Source:
  - Editor.js, line 656

#### isEmpty

True if empty, false otherwise

Source:
  - Editor.js, line 804

#### localTheme :string

Pen color used only for pending stroke

Source:
  - Editor.js, line 361

##### Type:

- `string`

#### model :Model

Current model

Source:
  - Editor.js, line 570

##### Type:

- `Model`

#### notifyTimer :Number

Notify delay timer

Source:
  - Editor.js, line 347

##### Type:

- `Number`

#### penStyle

Set the pen style

Source:
  - Editor.js, line 414

#### penStyle

Get the pen style

Source:
  - Editor.js, line 428

#### penStyleClasses

Set the pen style

Source:
  - Editor.js, line 436

#### penStyleClasses

Get the pen style

Source:
  - Editor.js, line 450

#### png

Get a PNG image data url from the data model

Source:
  - Editor.js, line 648

#### possibleUndoCount

Return the position of the cursor identifying the current state in the internal iink undo/redo stack.

Source:
  - Editor.js, line 867

#### recognizer

Get current recognizer

Source:
  - Editor.js, line 582

#### renderer

Get current renderer

Source:
  - Editor.js, line 616

#### rendererContext :Object

Current rendering context

Source:
  - Editor.js, line 607

##### Type:

- `Object`

#### resizeTimer :Number

Launch resize timer

Source:
  - Editor.js, line 341

##### Type:

- `Number`

#### stroker

Get current stroker

Source:
  - Editor.js, line 632

#### theme

Set the theme

Source:
  - Editor.js, line 458

#### theme

Get the theme

Source:
  - Editor.js, line 471

#### undoStackIndex

The number of operations that it is currently possible to undo.

Source:
  - Editor.js, line 875

### Methods

#### (async) clear() → {Promise.<*>}

Clear the output and the recognition result.

Source:
  - Editor.js, line 820

##### Returns:

Type:
  `Promise.<*>`

#### close() → {Promise.<*>}

Close websocket connection

Source:
  - Editor.js, line 963

##### Returns:

Type:
  `Promise.<*>`

#### convert(conversionState) → {Promise.<*>}

Convert the current content

Source:
  - Editor.js, line 845

##### Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`conversionState` | `string` | DIGITAL_EDIT |

##### Returns:

Type:
  `Promise.<*>`

#### export_(requestedMimeTypes)

Explicitly ask to perform an export. You have to listen to events to get the content as this function is non blocking and does not have a return type.

Source:
  - Editor.js, line 891

##### Parameters:

Name | Type | Description
--- | --- | ---
`requestedMimeTypes` | `Array.<String>` | Requested mime-types. Be sure to ask all the types required by the listeners of exported event.

#### forceChange()

Trigger the change callbacks (and by default send a change event).

Source:
  - Editor.js, line 973

#### getSupportedImportMimeTypes() → {Promise.<(*|null)>}

Get supported import mime types

Source:
  - Editor.js, line 913

##### Returns:

Type:
  `Promise.<(*|null)>`

#### import_(data, mimetypeopt)

Import content.

Source:
  - Editor.js, line 904

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`data` | `Blob` | `*` |  | Data to import
`mimetype` | `String` | <optional> | Mimetype of the data, needed if data is not a Blob

#### pointerDown(point, pointerTypeopt, pointerIdopt)

Handle a pointer down

Source:
  - Editor.js, line 666

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`point` | `Object` |  |  | Captured point coordinates
`pointerType` | `String` | <optional> | mouse | Current pointer type
`pointerId` | `String` | <optional> |  | Current pointer id

#### pointerEvents(events) → {Promise.<(*|null)>}

pointer events

Source:
  - Editor.js, line 922

##### Parameters:

Name | Type | Description
--- | --- | ---
`events` | `PointerEvents` |

##### Returns:

Type:
  `Promise.<(*|null)>`

#### pointerMove(point)

Handle a pointer move

Source:
  - Editor.js, line 679

##### Parameters:

Name | Type | Description
--- | --- | ---
`point` | `Object` | Captured point coordinates

#### pointerUp(point)

Handle a pointer up

Source:
  - Editor.js, line 690

##### Parameters:

Name | Type | Description
--- | --- | ---
`point` | `Object` | Captured point coordinates

#### (async) redo() → {Promise.<*>}

Redo the last action.

Source:
  - Editor.js, line 791

##### Returns:

Type:
  `Promise.<*>`

#### reDraw(rawStrokes, strokeGroups)

Deprecated:
  - Yes
Source:
  - Editor.js, line 728

##### Parameters:

Name | Type | Description
--- | --- | ---
`rawStrokes` |  |
`strokeGroups` |  |

#### resize()

Function to call when the dom element link to the current ink paper has been resize.

Source:
  - Editor.js, line 941

#### setGuides(enableopt) → {Promise.<(*|null)>}

Set the guides for text

Source:
  - Editor.js, line 858

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`enable` | `Boolean` | <optional> | true |

##### Returns:

Type:
  `Promise.<(*|null)>`

#### (async) undo() → {Promise.<*>}

Undo the last action.

Source:
  - Editor.js, line 770

##### Returns:

Type:
  `Promise.<*>`

#### unload()

Detach event listeners from the DOM element created at editor creation.

Source:
  - Editor.js, line 950

#### waitForIdle() → {Promise.<*>}

Wait for idle state.

Source:
  - Editor.js, line 753

##### Returns:

Type:
  `Promise.<*>`