Home Manual Reference Source
import {Editor} from 'myscript/src/Editor.js'
public class | source

Editor

Editor

Constructor Summary

Public Constructor
public

constructor(element: Element, configuration: Configuration, theme: Theme, penStyle: PenStyle, behaviors: Behaviors)

Member Summary

Public Members
public get

Get current behavior

public get

Get behaviors

public get

Get current callbacks

public get

True if can clear, false otherwise.

public get

True if can convert, false otherwise.

public get

True if can export, false otherwise.

public get

True if can redo, false otherwise.

public get

True if can undo, false otherwise.

public set

configuration(configuration: Configuration)

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

public get

configuration: Configuration: *

Get the current recognition parameters

public

domElement: Element

Inner reference to the DOM Element

public get

Get access to some easter egg features link ink injection.

public

error: *

public

Launch export timer

public get

Get current state exports

public get

Get current grabber

public

Current grabber context

public get

True if idle state

public get

True if initialized, false otherwise

public get

True if empty, false otherwise

public

loader: *

public
public

Pen color used only for pending stroke

public

Current model

public

Notify delay timer

public set

penStyle(penStyle: PenStyle)

Set the pen style

public get

Get the pen style

public set

penStyleClasses(penStyleClasses: String)

Set the pen style

public get

Get the pen style

public get

png: String: *

Get a PNG image data url from the data model

public get

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

public get

Get current recognizer

public

Current recognition context

public get

Get current renderer

public

Current rendering context

public

Launch resize timer

public
public get

Get current stroker

public get
public set

theme(theme: Theme)

Set the theme

public get

theme: Theme: *

Get the theme

public
public
public get

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

Private Members
private set

behavior(behavior: Behavior)

private
private
private

innerConfiguration: Configuration

private
private
private
private
private
private set

recognizer(recognizer: Recognizer)

Set the current recognizer

private set

renderer(renderer: Renderer)

Set the current renderer

Method Summary

Public Methods
public

clear()

Clear the output and the recognition result.

public

convert(conversionState: string)

Convert the current content

public

export_(requestedMimeTypes: Array<String>)

Explicitly ask to perform an export.

public

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

public

Get statistics to monitor what ink size is send to the server.

public

Get supported import mime types

public

import_(data: Blob | *, mimetype: String)

Import content.

public

pointerDown(point: {x: Number, y: Number, t: Number}, pointerType: String, pointerId: String)

Handle a pointer down

public

pointerEvents(events: PointerEvents)

pointer events

public

pointerMove(point: {x: Number, y: Number, t: Number})

Handle a pointer move

public

pointerUp(point: {x: Number, y: Number, t: Number})

Handle a pointer up

public

reDraw(rawStrokes: *, strokeGroups: *)

public

redo()

Redo the last action.

public

removeStroke(stroke: *)

public

resize()

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

public

setGuides(enable: Boolean)

Set the guides for text

public

setThemeForFont(lang: *)

Set the theme (font family, font size and line height) depending on the language

public

undo()

Undo the last action.

public

unload()

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

public

Wait for idle state.

Public Constructors

public constructor(element: Element, configuration: Configuration, theme: Theme, penStyle: PenStyle, behaviors: Behaviors) source

Params:

NameTypeAttributeDescription
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

Public Members

public get behavior: Behavior: * source

Get current behavior

Return:

Behavior

public get behaviors: Behaviors: * source

Get behaviors

Return:

Behaviors

public get callbacks: Array: * source

Get current callbacks

Return:

Array

public get canClear: Boolean: * source

True if can clear, false otherwise.

Return:

Boolean

public get canConvert: Boolean: * source

True if can convert, false otherwise.

Return:

Boolean

public get canExport: Boolean: * source

True if can export, false otherwise.

Return:

Boolean

public get canRedo: Boolean: * source

True if can redo, false otherwise.

Return:

Boolean

public get canUndo: Boolean: * source

True if can undo, false otherwise.

Return:

Boolean

public set configuration(configuration: Configuration) source

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

public get configuration: Configuration: * source

Get the current recognition parameters

Return:

Configuration

public domElement: Element source

Inner reference to the DOM Element

public get eastereggs: * source

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

public error: * source

public exportTimer: Number source

Launch export timer

public get exports: Object: * source

Get current state exports

Return:

Object

public get grabber: Grabber: * source

Get current grabber

Return:

Grabber

public grabberContext: GrabberContext source

Current grabber context

public get idle: Boolean: * source

True if idle state

Return:

Boolean

public get initialized: Boolean: * source

True if initialized, false otherwise

Return:

Boolean

public get isEmpty: boolean: * source

True if empty, false otherwise

Return:

boolean

public loader: * source

public localPenStyle: * source

public localTheme: string source

Pen color used only for pending stroke

public model: Model source

Current model

public notifyTimer: Number source

Notify delay timer

public set penStyle(penStyle: PenStyle) source

Set the pen style

public get penStyle: PenStyle: * source

Get the pen style

Return:

PenStyle

public set penStyleClasses(penStyleClasses: String) source

Set the pen style

public get penStyleClasses: String: * source

Get the pen style

Return:

String

public get png: String: * source

Get a PNG image data url from the data model

Return:

String

public get possibleUndoCount: Number: * source

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

Return:

Number

public get recognizer: Recognizer: * source

Get current recognizer

Return:

Recognizer

public recognizerContext: RecognizerContext source

Current recognition context

public get renderer: Renderer: * source

Get current renderer

Return:

Renderer

public rendererContext: Object source

Current rendering context

public resizeTimer: Number source

Launch resize timer

public smartGuide: * source

public get stroker: Stroker: * source

Get current stroker

Return:

Stroker

public get supportedImportMimeTypes: * source

public set theme(theme: Theme) source

Set the theme

public get theme: Theme: * source

Get the theme

Return:

Theme

public undoRedoContext: * source

public undoRedoManager: * source

public get undoStackIndex: Number: * source

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

Return:

Number

Private Members

private set behavior(behavior: Behavior) source

private innerBehavior: Behavior source

private innerBehaviors: Behaviors source

private innerConfiguration: Configuration source

private innerPenStyle: PenStyle source

private innerPenStyleClasses: String source

private innerRecognizer: Recognizer source

private innerRenderer: Renderer source

private innerTheme: Theme source

private set recognizer(recognizer: Recognizer) source

Set the current recognizer

private set renderer(renderer: Renderer) source

Set the current renderer

Public Methods

public clear() source

Clear the output and the recognition result.

public convert(conversionState: string) source

Convert the current content

Params:

NameTypeAttributeDescription
conversionState string
  • optional
  • default: DIGITAL_EDIT

public export_(requestedMimeTypes: Array<String>) source

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.

Params:

NameTypeAttributeDescription
requestedMimeTypes Array<String>

Requested mime-types. Be sure to ask all the types required by the listeners of exported event.

public forceChange() source

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

public getStats(): Stats source

Get statistics to monitor what ink size is send to the server.

Return:

Stats

public getSupportedImportMimeTypes() source

Get supported import mime types

public import_(data: Blob | *, mimetype: String) source

Import content.

Params:

NameTypeAttributeDescription
data Blob | *

Data to import

mimetype String
  • optional

Mimetype of the data, needed if data is not a Blob

public pointerDown(point: {x: Number, y: Number, t: Number}, pointerType: String, pointerId: String) source

Handle a pointer down

Params:

NameTypeAttributeDescription
point {x: Number, y: Number, t: Number}

Captured point coordinates

pointerType String
  • optional
  • default: mouse

Current pointer type

pointerId String
  • optional

Current pointer id

public pointerEvents(events: PointerEvents) source

pointer events

Params:

NameTypeAttributeDescription
events PointerEvents

public pointerMove(point: {x: Number, y: Number, t: Number}) source

Handle a pointer move

Params:

NameTypeAttributeDescription
point {x: Number, y: Number, t: Number}

Captured point coordinates

public pointerUp(point: {x: Number, y: Number, t: Number}) source

Handle a pointer up

Params:

NameTypeAttributeDescription
point {x: Number, y: Number, t: Number}

Captured point coordinates

public reDraw(rawStrokes: *, strokeGroups: *) source

Params:

NameTypeAttributeDescription
rawStrokes *
strokeGroups *

public redo() source

Redo the last action.

public removeStroke(stroke: *) source

Params:

NameTypeAttributeDescription
stroke *

public resize() source

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

public setGuides(enable: Boolean) source

Set the guides for text

Params:

NameTypeAttributeDescription
enable Boolean
  • optional

public setThemeForFont(lang: *) source

Set the theme (font family, font size and line height) depending on the language

Params:

NameTypeAttributeDescription
lang *

public undo() source

Undo the last action.

public unload() source

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

public waitForIdle() source

Wait for idle state.