Global

Members

(constant) CLOSE_RECOGNIZER_MESSAGE :String

Explicit close message
Source:
Type:
  • String

(constant) defaultBehaviors :Behaviors

Default behaviors
Source:
Type:

(constant) defaultConfiguration

Default configuration See https://developer.myscript.com/docs/interactive-ink/latest/reference/web/configuration/ for a full documentation of parameters.
Source:

(constant) defaultPenStyle :PenStyle

Default style
Source:
Type:

(constant) defaultTheme :Theme

Default theme
Source:
Type:

(constant) editorLogger :Object

Log editor events
Source:
Type:
  • Object

(constant) eventLogger :Object

Log callback events
Source:
Type:
  • Object

(constant) grabberLogger :Object

Log grabber events
Source:
Type:
  • Object

(constant) iinkRestConfiguration :RecognizerInfo

Recognizer configuration
Source:
Type:

(constant) IinkWsConfiguration :RecognizerInfo

Recognizer configuration
Source:
Type:

(constant) log :Object

Main log instance
Source:
Type:
  • Object

(constant) LOST_CONNEXION_MESSAGE :Object

Lost connection message
Source:
Type:
  • Object

(constant) MathSymbols :Object

Source:
Type:
  • Object

(constant) modelLogger :Object

Log model events
Source:
Type:
  • Object

(constant) recognizerLogger :Object

Log recognizer events
Source:
Type:
  • Object

(constant) rendererLogger :Object

Log grabber events
Source:
Type:
  • Object

(constant) ShapeSymbols :Object

Source:
Type:
  • Object

(constant) smartGuideLogger :Object

Log editor events
Source:
Type:
  • Object

(constant) testLogger :Object

Log tests events
Source:
Type:
  • Object

(constant) TextSymbols :Object

Source:
Type:
  • Object

(constant) utilLogger :Object

Log util events
Source:
Type:
  • Object

Methods

addListeners(editor, smartGuide)

Add the listeners to the smart guide elements.
Source:
Parameters:
Name Type Description
editor Editor A reference to the editor.
smartGuide SmartGuide A reference to the smart guide.

addPoint(stroke, point) → {Stroke}

Mutate a stroke by adding a point to it.
Source:
Parameters:
Name Type Description
stroke Stroke Current stroke
point Object Point to add
Returns:
Type:
Stroke
Updated stroke

addStroke(model, stroke) → {Model}

Mutate the model given in parameter by adding the new strokeToAdd.
Source:
Parameters:
Name Type Description
model Model Current model
stroke Stroke Stroke to be added to pending ones
Returns:
Type:
Model
Updated model

(async) addStrokes(editor, model, triggeropt) → {Promise}

Launch the recognition with all editor relative configuration and state.
Source:
Parameters:
Name Type Attributes Description
editor Editor
model Model
trigger String <optional>
Returns:
Type:
Promise

addStrokes(recognizerContext, model)

Add strokes to the model
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model

addStrokeToGroup(model, stroke, strokePenStyle) → {Model}

Mutate the model given in parameter by adding the new strokeToAdd and the penstyle. Used for iink REST.
Source:
Parameters:
Name Type Description
model Model Current model
stroke Stroke Stroke to be added to pending ones
strokePenStyle PenStyle
Returns:
Type:
Model
Updated model

addWebsocketAttributes(websocket, recognizerContext)

Attach all socket attributes helping managing server connexion
Source:
Parameters:
Name Type Description
websocket WebSocket Current WebSocket
recognizerContext RecognizerContext

appendToPendingStroke(model, point) → {Model}

Mutate the model by adding a point to the current pending stroke.
Source:
Parameters:
Name Type Description
model Model Current model
point Object Captured point to be append to the current stroke
Returns:
Type:
Model
Updated model

attach(element, editor, offsetTopopt, offsetLeftopt) → {GrabberContext}

Listen for the desired events
Source:
Parameters:
Name Type Attributes Default Description
element Element DOM element to attach events listeners
editor Editor Editor to received down/move/up events
offsetTop Number <optional>
0
offsetLeft Number <optional>
0
Listens to Events:
  • {Event} pointermove: a pointer moves,event: similar to touchmove or mousemove.
  • {Event} pointerdown: a pointer is activated,event: or a device button held.
  • {Event} pointerup: a pointer is deactivated,event: or a device button released.
  • event:{Event} pointerover: a pointer has moved onto an element.
  • event:{Event} pointerout: a pointer is no longer on an element it once was.
  • event:{Event} pointerenter: a pointer enters the bounding box of an element.
  • event:{Event} pointerleave: a pointer leaves the bounding box of an element.
  • event:{Event} pointercancel: a pointer will no longer generate events.
Returns:
Type:
GrabberContext
Grabber context

attach(element, minHeightopt, minWidthopt) → {Object}

Attach the renderer to the DOM element
Source:
Parameters:
Name Type Attributes Default Description
element Element DOM element to attach the rendering elements
minHeight Number <optional>
0 Minimal height of the editor
minWidth Number <optional>
0 Minimal width of the editor
Returns:
Type:
Object
The renderer context to give as parameter when a draw model will be call

attach(element) → {Object}

Populate the dom element
Source:
Parameters:
Name Type Description
element Element DOM element to attach the rendering elements
Returns:
Type:
Object
The renderer context to give as parameter when a draw model will be call

buildHmacMessage()

A websocket dialog have this sequence : ---------- Client ------------------------------------- Server ---------------------------------- init (send the new content package) ================> <=========== hmacChallenge answerToHmacChallenge (send the hmac) =========> newPart (send the parameters ) ===============> <=========== update addStrokes (send the strokes ) ============> <=========== update
Source:

buildWebSocketCallback(destructuredPromise, recognizerContext) → {function}

This function bind the right behaviour when a message is receive by the websocket.
Source:
Parameters:
Name Type Description
destructuredPromise DestructuredPromise
recognizerContext RecognizerContext Current recognizer context
Returns:
Type:
function
Callback to handle WebSocket results

callFadeOutObserver(durationopt, smartGuide)

Call mutation observer to trigger fade out animation.
Source:
Parameters:
Name Type Attributes Default Description
duration number <optional>
10000 the duration in milliseconds before calling the fade out animation.
smartGuide SmartGuide A reference to the smart guide.

canReconnect(recognizerContext) → {Boolean}

Test if it is possible to reconnect
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext
Returns:
Type:
Boolean
True if possible, false otherwise

clear(recognizerContext, model) → {Promise}

Clear server context. Currently nothing to do there.
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognizer context
model Model Current model
Returns:
Type:
Promise

clear(recognizerContext, model, callback)

Do what is needed to clean the server context.
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognizer context
model Model Current model
callback RecognizerCallback

clear(recognizerContext, model)

Clear action
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model

clearModel(model) → {Model}

Clear the model.
Source:
Parameters:
Name Type Description
model Model Current model
Returns:
Type:
Model
Cleared model

clickCandidate(evt, editor, smartGuide)

Call the import_ function of the editor to import the modified Jiix with the new label.
Source:
Parameters:
Name Type Description
evt Event Event to determine the clicked candidate.
editor Editor A reference to the editor.
smartGuide SmartGuide A reference to the smart guide.

cloneModel(model) → {Model}

Clone model
Source:
Parameters:
Name Type Description
model Model Current model
Returns:
Type:
Model
Clone of the current model

close(recognizerContext, model) → {Promise}

Close and free all resources that will no longer be used by the recognizer.
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognizer context
model Model Current model
Returns:
Type:
Promise

close(recognizerContext, model)

Close and free all resources that will no longer be used by the recognizer.
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext
model Model

close(recognizerContext, code, reason)

Close the websocket
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognizer context
code Number Exit code
reason String Exit reason

computeAxeAngle(begin, end) → {Number}

Source:
Parameters:
Name Type Description
begin Object
end Object
Returns:
Type:
Number

computeHmac(input, applicationKey, hmacKey) → {String}

Compute HMAC signature for server authentication
Source:
Parameters:
Name Type Description
input Object Input data to compute HMAC
applicationKey String Current applicationKey
hmacKey String Current hmacKey
Returns:
Type:
String
Signature

computeLinksPoints(point, angle, width) → {Object|Object}

Source:
Parameters:
Name Type Description
point Object
angle
width
Returns:
Type:
Object | Object

computeMiddlePoint(point1, point2) → {Object}

Source:
Parameters:
Name Type Description
point1 Object
point2 Object
Returns:
Type:
Object

convert(recognizerContext, model)

Ask for conversion using DIGITAL_EDIT
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognizer context
model Model Current model

convert(recognizerContext, model, conversionState)

Convert action
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model
conversionState String Conversion State, by default DigitalEdit

createEmptyRecognizerContext(editor) → {RecognizerContext}

Create a new recognizer context
Source:
Parameters:
Name Type Description
editor Editor
Returns:
Type:
RecognizerContext
An object that contains all recognizer context

createHTMLElements()

Create all the smart guide HTML elements.
Source:

createModel(configurationopt) → {Model}

Create a new model
Source:
Parameters:
Name Type Attributes Description
configuration Configuration <optional>
Parameters to use to populate default recognition symbols
Returns:
Type:
Model
New model

createSmartGuide(editor) → {SmartGuide}

Create a new smart guide
Source:
Parameters:
Name Type Description
editor Editor A reference to the editor.
Returns:
Type:
SmartGuide
New smart guide

createStrokeComponent(properties) → {Stroke}

Create a new stroke
Source:
Parameters:
Name Type Description
properties Object Properties to be applied to the stroke.
Returns:
Type:
Stroke
New stroke with properties for quadratics draw

createUndoRedoContext(configuration) → {UndoRedoContext}

Create a new undo/redo context
Source:
Parameters:
Name Type Description
configuration Configuration Current configuration
Returns:
Type:
UndoRedoContext
New undo/redo context

delay(time) → {Object}

Source:
Parameters:
Name Type Description
time
Returns:
Type:
Object

destructurePromise() → {Object}

destructurePromise
Source:
Returns:
Type:
Object

detach(element, context)

Detach the renderer from the DOM element
Source:
Parameters:
Name Type Description
element Element DOM element to attach the rendering elements
context Object Current rendering context

detach(element, context)

Detach the renderer from the DOM element
Source:
Parameters:
Name Type Description
element Element DOM element to attach the rendering elements
context Object Current rendering context

drawCurrentStroke(context, model, stroker) → {Model}

Draw the current stroke from the model
Source:
Parameters:
Name Type Description
context Object Current rendering context
model Model Current model
stroker Stroker Current stroker
Returns:
Type:
Model

drawCurrentStroke(context, model, stroker) → {Model}

Draw the current stroke from the model
Source:
Parameters:
Name Type Description
context Object Current rendering context
model Model Current model
stroker Stroker Current stroker
Returns:
Type:
Model

drawLine(context, p1, p2)

Draw a line
Source:
Parameters:
Name Type Description
context Object Current rendering context
p1 Object Origin point
p2 Object Destination point

drawMathSymbol(context, symbol, model, stroker)

Draw a math symbol
Source:
Parameters:
Name Type Description
context Object Current rendering context
symbol Object Symbol to draw
model Model Current model
stroker Stroker Stroker to use to render a stroke

drawModel(context, model, stroker) → {Model}

Draw all symbols contained into the model
Source:
Parameters:
Name Type Description
context Object Current rendering context
model Model Current model
stroker Stroker Current stroker
Returns:
Type:
Model

drawModel(context, model, stroker) → {Model}

Draw all symbols contained into the model
Source:
Parameters:
Name Type Description
context Object Current rendering context
model Model Current model
stroker Stroker Current stroker
Returns:
Type:
Model

drawShapeSymbol(context, symbol)

Draw a shape symbol
Source:
Parameters:
Name Type Description
context Object Current rendering context
symbol Object Symbol to draw

drawStroke(context, stroke)

Draw a stroke on a canvas, using quadratics
Source:
Parameters:
Name Type Description
context Object Current rendering context
stroke Stroke Current stroke to be drawn

drawStroke(context, stroke, stroker)

Draw a stroke symbol
Source:
Parameters:
Name Type Description
context Object Current rendering context
stroke Stroke Stroke to be drawn
stroker Stroker Stroker to use to render a stroke

drawStroke(context, stroke)

Draw a stroke on a svg tag, using quadratics
Source:
Parameters:
Name Type Description
context Object Current rendering context
stroke Stroke Current stroke to be drawn

drawStroke(context, stroke, stroker)

Draw a stroke symbol
Source:
Parameters:
Name Type Description
context Object Current rendering context
stroke Stroke Stroke to be drawn
stroker Stroker Stroker to use to render a stroke

drawTextSymbol(context, symbol)

Draw a text symbol
Source:
Parameters:
Name Type Description
context Object Current rendering context
symbol Object Symbol to draw

emitEvents(editor, data, …types) → {Model}

Emit events
Source:
Parameters:
Name Type Attributes Description
editor Editor
data Object
types String <repeatable>
Returns:
Type:
Model

endPendingStroke(model, point, penStyle) → {Model}

Mutate the model by adding the new point on a initPendingStroke.
Source:
Parameters:
Name Type Description
model Model Current model
point Object Captured point to be append to the current stroke
penStyle PenStyle
Returns:
Type:
Model
Updated model

export_(recognizerContext, model, requestedMimeTypes)

Export content
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognizer context
model Model Current model
requestedMimeTypes Array

export_(recognizerContext, model, requestedMimeTypes)

Export action
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model
requestedMimeTypes Array

extractPendingRecognizedSymbols(model, positionopt) → {Array.<Object>}

Get the symbols that needs to be rendered
Source:
Parameters:
Name Type Attributes Default Description
model Model Current model
position Number <optional>
lastRendered Index from where to extract symbols
Returns:
Type:
Array.<Object>

extractPendingStrokes(model, positionopt) → {Array.<Stroke>}

Get the strokes that needs to be recognized
Source:
Parameters:
Name Type Attributes Default Description
model Model Current model
position Number <optional>
lastReceived Index from where to extract strokes
Returns:
Type:
Array.<Stroke>
Pending strokes

extractStrokesFromInkRange(model, firstStroke, lastStroke, firstPoint, lastPoint) → {Array.<Stroke>}

Extract strokes from an ink range
Source:
Parameters:
Name Type Description
model Model Current model
firstStroke Number First stroke index to extract
lastStroke Number Last stroke index to extract
firstPoint Number First point index to extract
lastPoint Number Last point index to extract
Returns:
Type:
Array.<Stroke>
The extracted strokes

getAvailableLanguageList(configurationopt) → {JSON}

Return the list of available recognition languages
Source:
Parameters:
Name Type Attributes Description
configuration Configuration <optional>
Configuration to get the languages
Returns:
Type:
JSON
A list of available languages

getBorderCoordinates(model) → {Bounds}

Get the bounds of the current model.
Source:
Parameters:
Name Type Description
model Model Current model
Returns:
Type:
Bounds
Bounding box enclosing the current drawn model

getImage(model, stroker, marginopt) → {String}

Generate a PNG image data url from the model
Source:
Parameters:
Name Type Attributes Default Description
model Model Current model
stroker Stroker Current stroker
margin Number <optional>
10 Margins to apply around the image
Returns:
Type:
String
Image data string result

getInfo() → {RecognizerInfo}

Get the configuration supported by this recognizer
Source:
Returns:
Type:
RecognizerInfo

getInfo() → {RecognizerInfo}

Get the configuration supported by this recognizer
Source:
Returns:
Type:
RecognizerInfo

getInfo() → {RendererInfo}

Get info
Source:
Returns:
Type:
RendererInfo
Information about this renderer

getInfo() → {StrokerInfo}

Get info
Source:
Returns:
Type:
StrokerInfo
Information about this stroker

getInfo() → {RendererInfo}

Get info
Source:
Returns:
Type:
RendererInfo
Information about this renderer

getInfo() → {StrokerInfo}

Get info
Source:
Returns:
Type:
StrokerInfo
Information about this stroker

getModel(undoRedoContext, cloneopt, …types)

Get current model in stack
Source:
Parameters:
Name Type Attributes Default Description
undoRedoContext UndoRedoContext Current undo/redo context
clone Boolean <optional>
true Whether or not to clone the model
types String <repeatable>

getPointByIndex(stroke, index) → {Object}

Extract point by index
Source:
Parameters:
Name Type Description
stroke Stroke Current stroke
index Number Zero-based index
Returns:
Type:
Object
Point with properties for quadratics draw

getSupportedImportMimeTypes(recognizerContext, model)

Ask for the supported mimetypes
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model

getSymbolsBounds(symbols, boundsopt) → {Bounds}

Get the box enclosing the given symbols
Source:
Parameters:
Name Type Attributes Description
symbols Array Symbols to extract bounds from
bounds Bounds <optional>
Starting bounds for recursion
Returns:
Type:
Bounds
Bounding box enclosing symbols

handleError(editor, err, …events)

Method called when server respond with an error Use in catch on Promises
Source:
Parameters:
Name Type Attributes Description
editor Editor
err Object
events String <repeatable>

handleSuccess(editor, model, …events)

Method called when server respond correctly to request or WS Use in then on Promises
Source:
Parameters:
Name Type Attributes Description
editor Editor
model Object
events String <repeatable>

import_(recognizerContext, model, data)

Import action
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model
data Blob Import data

init(recognizerContext, model) → {Promise}

Initialize recognition
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognizer context
model Model Current model
Returns:
Type:
Promise

init(suffixUrl, recognizerContext, buildWebSocketCallback, reconnect) → {Promise}

Init the websocket recognizer. Open the connexion and proceed to the hmac challenge.
Source:
Parameters:
Name Type Description
suffixUrl String
recognizerContext RecognizerContext
buildWebSocketCallback BuildWebSocketFunction
reconnect function
Returns:
Type:
Promise
Fulfilled when the init phase is over.

init(recognizerContext, model)

Initialize recognition The init process is in multiple part : - partChange - contentChange - initPromise: resolved only if partChange & contentChange resolved except for MATH recognition
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognizer context
model Model Current model

initPendingStroke(model, point, properties, dpiopt) → {Model}

Mutate the model by adding a point and close the current stroke.
Source:
Parameters:
Name Type Attributes Default Description
model Model Current model
point Object Captured point to create current stroke
properties Object Properties to be applied to the current stroke
dpi Number <optional>
96 The screen dpi resolution
Returns:
Type:
Model
Updated model

inkImporter(editorParam, strokes, delayBetweenStrokes, lastOneDelay)

Function to copy past to inject ink during tutorial.
Source:
Parameters:
Name Type Description
editorParam
strokes
delayBetweenStrokes
lastOneDelay

insertSmartGuide(smartGuide)

Insert the smart guide HTML elements in the DOM.
Source:
Parameters:
Name Type Description
smartGuide SmartGuide A reference to the smart guide.

isInShadow(node) → {boolean}

Check if node is in shadow dom
Source:
Parameters:
Name Type Description
node Node A node element.
Returns:
Type:
boolean
true if is in shadow dom, false otherwise.

isResetRequired(recognizerContext, model) → {Boolean}

Return true if a reset is required, false otherwise
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext
model Model
Returns:
Type:
Boolean

isTriggerValid(editor, type, triggeropt) → {Boolean}

Check if the trigger in parameter is valid.
Source:
Parameters:
Name Type Attributes Description
editor Editor
type String
trigger String <optional>
Returns:
Type:
Boolean

(async) launchClose(editor, model) → {Promise.<*>}

Launch websocket close
Source:
Parameters:
Name Type Description
editor Editor
model Model
Returns:
Type:
Promise.<*>

(async) launchConfig(editor, model) → {Promise.<*>}

Launch the configuration for the editor
Source:
Parameters:
Name Type Description
editor Editor
model Model
Returns:
Type:
Promise.<*>

(async) launchConvert(editor, model, conversionState) → {Promise.<*>}

Launch the convert with all editor relative configuration and state.
Source:
Parameters:
Name Type Description
editor Editor
model Model
conversionState String
Returns:
Type:
Promise.<*>

launchExport(editor, model, requestedMimeTypesopt, triggeropt)

Launch the recognition with all editor relative configuration and state.
Source:
Parameters:
Name Type Attributes Description
editor Editor
model Model
requestedMimeTypes String <optional>
trigger String <optional>

(async) launchGetSupportedImportMimeTypes(editor, model) → {Promise.<*>}

Get the supported mimetypes for import.
Source:
Parameters:
Name Type Description
editor Editor
model Model
Returns:
Type:
Promise.<*>

(async) launchImport(editor, model, data) → {Promise.<*>}

Launch the import.
Source:
Parameters:
Name Type Description
editor Editor
model Model
data Blob
Returns:
Type:
Promise.<*>

(async) launchPointerEvents(editor, model, events) → {Promise.<*>}

Launch ink import.
Source:
Parameters:
Name Type Description
editor Editor
model Model
events PointerEvents
Returns:
Type:
Promise.<*>

(async) launchResize(editor, model)

Launch the resize.
Source:
Parameters:
Name Type Description
editor Editor
model Model

launchSmartGuide(smartGuide, exports)

Launch the smartguide.
Source:
Parameters:
Name Type Description
smartGuide SmartGuide A reference to the smart guide.
exports Object The export from the editor.

(async) launchWaitForIdle(editor, model) → {Promise.<*>}

Launch wait for idle
Source:
Parameters:
Name Type Description
editor Editor
model Model
Returns:
Type:
Promise.<*>

manageRecognizedModel(editor, model, …types)

Manage recognized model
Source:
Parameters:
Name Type Attributes Description
editor Editor
model Model
types String <repeatable>

manageResetState(editor, model) → {Promise.<*>}

Check if a clear is required, and does it if it is
Source:
Parameters:
Name Type Description
editor Editor
model Model Current model
Returns:
Type:
Promise.<*>

mergeModels(…models) → {Model}

Merge models
Source:
Parameters:
Name Type Attributes Description
models Model <repeatable>
Models to merge (ordered)
Returns:
Type:
Model
Updated model

needRedraw(model) → {Boolean}

Check if the model needs to be redrawn.
Source:
Parameters:
Name Type Description
model Model Current model
Returns:
Type:
Boolean
True if the model needs to be redrawn, false otherwise

newContentPart(recognizerContext, model)

Create a new content part
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model

openContentPart(recognizerContext, model)

Open the recognizer context content part
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model

openWebSocket(recognizerContext) → {WebSocket}

Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Recognizer context
Returns:
Type:
WebSocket
Opened WebSocket

overrideDefaultBehaviors(behaviors) → {Behaviors}

Generate behaviors
Source:
Parameters:
Name Type Description
behaviors Behaviors Behaviors to be used
Returns:
Type:
Behaviors
Overridden behaviors

overrideDefaultConfiguration(configuration) → {Configuration}

Generate parameters
Source:
Parameters:
Name Type Description
configuration Configuration Configuration to be used
Returns:
Type:
Configuration
Overridden configuration

overrideDefaultPenStyle(style) → {PenStyle}

Generate style
Source:
Parameters:
Name Type Description
style PenStyle Custom style to be applied
Returns:
Type:
PenStyle
Overridden style

overrideDefaultTheme(theme) → {Theme}

Generate theme
Source:
Parameters:
Name Type Description
theme Theme Custom theme to be applied
Returns:
Type:
Theme
Overridden theme

pointerEvents(recognizerContext, model, events)

Pointer Events
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model
events PointerEvents to be imported

post(recognizerContext, url, data, apiVersion, mimeType) → {Promise}

Post request
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Recognizer context
url String URL
data Object Data to be sent
apiVersion String api version
mimeType String MimeType to be used
Returns:
Type:
Promise

postMessage(suffixUrl, recognizerContext, model, buildMessage, conversionState, mimeType) → {Promise.<Model>}

Source:
Parameters:
Name Type Description
suffixUrl String
recognizerContext RecognizerContext
model Model
buildMessage function
conversionState String
mimeType String
Returns:
Type:
Promise.<Model>
Promise that return an updated model as a result

redo(undoRedoContext, model)

Redo
Source:
Parameters:
Name Type Description
undoRedoContext UndoRedoContext Current undo/redo context.
model Model Current model.

redo(recognizerContext, model)

Redo last action
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model

register(element, configurationopt, penStyleopt, themeopt, behaviorsopt, globalClassCSSopt) → {Editor}

Attach an Editor to a DOMElement
Source:
Parameters:
Name Type Attributes Description
element Element DOM element to attach an editor
configuration Configuration <optional>
Configuration to apply
penStyle PenStyle <optional>
Pen style to apply
theme Theme <optional>
Theme to apply
behaviors Behaviors <optional>
Custom behaviors to apply
globalClassCSS String <optional>
Replace global class css 'ms-editor' to customize style
Returns:
Type:
Editor
New editor

reset(recognizerContext, model) → {Promise}

Reset server context. Currently nothing to do there.
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognizer context
model Model Current model
Returns:
Type:
Promise

resetModelPositions(model) → {Model}

Reset model lastReceivedPosition and lastSentPosition
Source:
Parameters:
Name Type Description
model Model
Returns:
Type:
Model

resetModelRendererPosition(model) → {Model}

Reset model lastRenderedPosition
Source:
Parameters:
Name Type Description
model Model
Returns:
Type:
Model

resize(recognizerContext, model)

Resize
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model

resize(recognizerContext, model, element)

Resize
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model
element Element Current element

resize(context, model, stroker) → {Model}

Update the rendering context size
Source:
Parameters:
Name Type Description
context Object Current rendering context
model Model Current model
stroker Stroker Current stroker
Returns:
Type:
Model

resize(context, model, stroker, minHeight, minWidth) → {Model}

Update the rendering context size
Source:
Parameters:
Name Type Description
context Object Current rendering context
model Model Current model
stroker Stroker Current stroker
minHeight Number Minimal height for resize
minWidth Number Minimal Width for resize
Returns:
Type:
Model

send(recognizerContext, message)

Send data message
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognizer context
message Object Data message

sendConfiguration(recognizerContext, model)

Send the recognizer configuration
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model

sendMessage(recognizerContext, buildMessage, …params) → {Promise}

Source:
Parameters:
Name Type Attributes Description
recognizerContext RecognizerContext
buildMessage function
params Object <repeatable>
Returns:
Type:
Promise

(async) setPenStyle(editor, model) → {Promise.<*>}

Set pen style.
Source:
Parameters:
Name Type Description
editor Editor
model Model
Returns:
Type:
Promise.<*>

setPenStyle(recognizerContext, model, penStyle)

SetPenStyle action
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model
penStyle PenStyle Current penStyle

(async) setPenStyleClasses(editor, model) → {Promise.<*>}

Set pen style.
Source:
Parameters:
Name Type Description
editor Editor
model Model
Returns:
Type:
Promise.<*>

setPenStyleClasses(recognizerContext, model, penStyleClasses)

setPenStyleClasses action
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model
penStyleClasses String Current penStyleClasses

setRecognitionContext(recognizerContext, recognitionContext) → {RecognizerContext}

Set the recognition context
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognizer context
recognitionContext RecognitionContext
Returns:
Type:
RecognizerContext

(async) setTheme(editor, model) → {Promise.<*>}

Set theme.
Source:
Parameters:
Name Type Description
editor Editor
model Model
Returns:
Type:
Promise.<*>

setTheme(recognizerContext, model, theme)

SetTheme action
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model
theme Theme Current theme

shouldAttemptImmediateReconnect(recognizerContext) → {Boolean}

Test if it should attempt immediate reconnect
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext
Returns:
Type:
Boolean
True if should attempt reconnect, false otherwise

showActions(evt, elements, smartGuide)

Show the actions of the action menu.
Source:
Parameters:
Name Type Description
evt Event Event used to insert the option div using the event's target.
elements Object All the elements of the smart guide.
smartGuide SmartGuide

showCandidates(evt, editor, smartGuide)

Show the candidates of the clicked word.
Source:
Parameters:
Name Type Description
evt Event Event used to determine the clicked word.
editor Editor A reference to the editor.
smartGuide SmartGuide A reference to the smart guide.

slice(stroke, startopt, endopt) → {Stroke}

Slice a stroke and return the sliced part of it
Source:
Parameters:
Name Type Attributes Default Description
stroke Stroke Current stroke
start Number <optional>
0 Zero-based index at which to begin extraction
end Number <optional>
length Zero-based index at which to end extraction
Returns:
Type:
Stroke
Sliced stroke

toJSON(stroke) → {Object}

Get a JSON copy of a stroke by filtering its properties
Source:
Parameters:
Name Type Description
stroke Stroke Current stroke
Returns:
Type:
Object
Simplified stroke object

undo(undoRedoContext, model)

Undo
Source:
Parameters:
Name Type Description
undoRedoContext UndoRedoContext Current undo/redo context.
model Model Current model.

undo(recognizerContext, model)

Undo last action
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model

updateModel(undoRedoContext, model)

Mutate the undoRedo stack by adding a new model to it.
Source:
Parameters:
Name Type Description
undoRedoContext UndoRedoContext Current undo/redo context.
model Model Current model.

updateModelReceivedPosition(model) → {Model}

Update model lastReceivedPosition regarding to lastSentPosition
Source:
Parameters:
Name Type Description
model Model
Returns:
Type:
Model

updateModelRenderedPosition(model, positionopt) → {Model}

Update model lastRenderedPosition
Source:
Parameters:
Name Type Attributes Description
model Model
position Number <optional>
Returns:
Type:
Model

updateModelSentPosition(model, positionopt) → {Model}

Update model lastSentPosition
Source:
Parameters:
Name Type Attributes Description
model Model
position Number <optional>
Returns:
Type:
Model

updateRecognitionPositions(recognizerContext, positions) → {RecognizerContext}

Update the recognition context positions
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognizer context
positions RecognitionPositions Current recognition positions
Returns:
Type:
RecognizerContext

updateUndoRedoState(undoRedoContext) → {UndoRedoContext}

Update the undo/redo state
Source:
Parameters:
Name Type Description
undoRedoContext UndoRedoContext Current undo/redo context
Returns:
Type:
UndoRedoContext
Updated undo/redo context

waitForIdle(recognizerContext, model)

WaitForIdle action
Source:
Parameters:
Name Type Description
recognizerContext RecognizerContext Current recognition context
model Model Current model

zoom(recognizerContext, model, value)

Zoom action
Source:
Parameters:
Name Type Default Description
recognizerContext RecognizerContext Current recognition context
model Model Current model
value Number 10 Zoom value

Type Definitions

Behavior

Current behavior
Properties:
Name Type Description
grabber Grabber Grabber to capture strokes
stroker Stroker Stroker to draw stroke
renderer Renderer Renderer to draw on the editor
recognizer Recognizer Recognizer to call the recognition service
events Array Functions to handle model changes
Source:
Type:
  • Object

Behaviors

Set of behaviors to be used by the Editor
Properties:
Name Type Description
grabber Grabber Grabber to capture strokes
strokerList Array.<Stroker> List of stroker to draw stroke
rendererList Array.<Renderer> List of renderer to draw on the editor
recognizerList Array.<Recognizer> Recognizers to call the recognition service
getBehaviorFromConfiguration function Get the current behavior to use regarding the current configuration
events Array Functions to handle model changes
Source:
Type:
  • Object

Bounds

Bounding box
Properties:
Name Type Description
minX Number Minimal x coordinate
maxX Number Maximal x coordinate
minY Number Minimal y coordinate
maxY Number Maximal y coordinate
Source:
Type:
  • Object

BuildWebSocketFunction(destructuredPromise, recognizerContext) → {Callback}

Build websocket function
Source:
Parameters:
Name Type Description
destructuredPromise DestructuredPromise
recognizerContext RecognizerContext
Returns:
Type:
Callback

Callback(erropt, resopt)

Simple callback
Source:
Parameters:
Name Type Attributes Description
err Object <optional>
Error
res Object <optional>
Result

Constants

Source:
Type:
  • Object

DestructuredPromise

Properties:
Name Type Description
promise Promise
resolve function
reject function
Source:
Type:
  • Object

GeneratedTheme

Properties:
Name Type Default Description
font-family String STIXGeneral Font-family to be used
color String #A8A8A8FF Color to be used
Source:
Type:
  • Object

Grabber

Grab pointerDown, pointerMove and pointerUp events
Properties:
Name Type Description
attach function Attach events and decide when to call editor pointerDown/Move/Up methods
detach function Detach the grabber
Source:
Type:
  • Object

GrabberContext

Grabber context
Properties:
Name Type Description
options Boolean | Object Options object that specifies characteristics about the event listener. (@see addEventListener.options for detail)
listeners Array.<GrabberListener> Registered listeners
Source:
Type:
  • Object

GrabberListener

Grabber listener
Properties:
Name Type Description
types Array.<String> Event types to listen
listener function Event listener for these events
Source:
Type:
  • Object

MathTheme

Properties:
Name Type Default Description
font-family String STIXGeneral Font-family to be used
Source:
Type:
  • Object

Model

Editor model
Properties:
Name Type Default Description
currentStroke Stroke Stroke in building process.
rawStrokes Array.<Stroke> [ List of captured strokes.
strokeGroups Array [ Group of strokes with same pen style.
lastPositions RecognitionPositions Last recognition sent/received stroke indexes.
defaultSymbols Array.<Object> [ Default symbols, relative to the current recognition type.
recognizedSymbols Array.<Object> Symbols to render (e.g. stroke, shape primitives, string, characters...).
exports Object Result of the export (e.g. mathml, latex, text...).
rawResults RawResults The recognition output as return by the recognition service.
creationTime Number Date of creation timestamp.
modificationTime Number Date of lastModification.
Source:
Type:
  • Object

PenStyle

Properties:
Name Type Default Description
color String #000000 Color (supported formats rgb() rgba() hsl() hsla() #rgb #rgba #rrggbb #rrggbbaa)
-myscript-pen-width String 1 Width of strokes and primitives in mm (no other unit is supported yet)
-myscript-pen-fill-style String none
-myscript-pen-fill-color String #FFFFFF00 Color filled inside the area delimited by strokes and primitives
Source:
Type:
  • Object

pointerEvents

pointerEvents symbol
Properties:
Name Type Default Description
type String pointerEvents Symbol type, 'pointerEvents' for pointerEvents
processGestures Boolean False indicates if the gestures have to be processed
events Array.<Stroke> [ the events to process
Source:
Type:
  • Object

RawResults

Raw results
Properties:
Name Type Description
convert Object The convert result
exports Object The exports output as return by the recognition service.
Source:
Type:
  • Object

RecognitionContext

Recognition context
Properties:
Name Type Description
model Model
callback Callback
Source:
Type:
  • Object

RecognitionPositions

Recognition positions
Properties:
Name Type Attributes Default Description
lastSentPosition Number <optional>
-1 Index of the last sent stroke.
lastReceivedPosition Number <optional>
-1 Index of the last received stroke.
lastRenderedPosition Number <optional>
-1 Last rendered recognized symbol position
Source:
Type:
  • Object

Recognizer

Recognition service entry point
Properties:
Name Type Attributes Description
getInfo function Get information about the supported configuration (protocol, type, apiVersion, ...).
init function Initialize recognition.
clear function Clear server context. Currently nothing to do there.
close function Close and free all resources that will no longer be used by the recognizer.
undo function <optional>
Undo Undo the last done action.
redo function <optional>
Redo Redo the previously undone action.
resize function <optional>
Resize.
pointerEvents function <optional>
Pointer Events.
addStrokes function <optional>
Add strokes.
export_ function <optional>
Export content.
import_ function <optional>
Import content.
convert function <optional>
Convert.
waitForIdle function <optional>
Wait for idle.
setPenStyle function <optional>
Set pen style.
setPenStyleClasses function <optional>
Set pen style classes.
setTheme function <optional>
Set theme.
Source:
Type:
  • Object

RecognizerCallback(erropt, modelopt, …typesopt)

Recognizer callback
Source:
Parameters:
Name Type Attributes Description
err Object <optional>
Error
model Model <optional>
Result
types String <optional>
<repeatable>
Result types

RecognizerContext

Recognizer context
Properties:
Name Type Default Description
editor Editor Get a reference to the current editor
recognitionContexts Array.<RecognitionContext> [
initPromise Promise
lastPositions RecognitionPositions Last recognition sent/received stroke indexes.
url String
websocket WebSocket
websocketCallback function
reconnect function
currentReconnectionCount Number 0
sessionId String
contentPartCount Number 0
currentPartId String
instanceId String
canUndo Boolean false
canRedo Boolean false
isEmpty Boolean false
supportedImportMimeTypes Array [
undoStackIndex Number 0
possibleUndoCount Number 0
idle Boolean true
initialized Boolean false
Source:
Type:
  • Object

RecognizerInfo

Recognizer info
Properties:
Name Type Description
types Array.<String> Supported recognition types (TEXT, MATH, SHAPE, MUSIC, ANALYZER).
protocol String Supported protocol (REST, WEBSOCKET).
apiVersion String Supported API version.
availableTriggers Triggers Supported triggers for this recognizer.
Source:
Type:
  • Object

Renderer

Default renderer
Properties:
Name Type Description
getInfo function Get some information about this renderer
attach function Populate the DOM element to create rendering area.
detach function Remove rendering area from the DOM element.
resize function Explicitly resize the rendering area.
drawCurrentStroke function Draw the model currentStroke.
drawModel function Draw the model defaultSymbols and recognizedSymbols.
Source:
Type:
  • Object

RendererInfo

Renderer info
Properties:
Name Type Description
type String Renderer type.
apiVersion String Supported api version.
Source:
Type:
  • Object

SmartGuide

Smart guide
Properties:
Name Type Description
editor Editor A reference to the current editor.
wordToChange String Word to change following a click on a word.
lastWord String Keep the last word of the previous export to compare with the new and scroll if it's different.
previousLabelExport String Keep the previous label export to know if we should repopulate the prompter text.
perfectScrollbar PerfectScrollbar Perfect Scrollbar used to get gestures from smart guide using touch-action none anyway and get scrolling too.
elements Object All the HTML elements of the smart guide.
smartGuideTimeOutId Number Id of the setTimeOut from fade out animation to clear.
randomString String Random string used in case of multiple smart guide.
Source:
Type:
  • Object

Stroke

Stroke symbol
Properties:
Name Type Default Description
type String stroke Symbol type, 'stroke' for stroke
pointerType String Pointer type
pointerId Number Pointer id
x Array.<Number> [ X coordinates
y Array.<Number> [ Y coordinates
t Array.<Number> [ Timestamps matching x,y coordinates
p Array.<Number> [ Pressure
l Array.<Number> [ Length from origin
width Number 0 (for rendering) Pen/brush width
color String (for rendering) Pen/brush color
Source:
Type:
  • Object

Stroker

Define how a stroke should be drawn
Properties:
Name Type Description
getInfo function Get some information about this stroker
drawStroke function Render a stroke on the current context.
Source:
Type:
  • Object

StrokerInfo

Stroker info
Properties:
Name Type Description
type String Renderer type.
name String Stroker name.
apiVersion String Supported api version.
Source:
Type:
  • Object

TextTheme

Properties:
Name Type Default Description
font-family String OpenSans Font-family to be used
font-size Number 10 Font-size to be used
Source:
Type:
  • Object

Theme

Properties:
Name Type Description
ink InkTheme General settings
.math MathTheme Math theme
.math-solver GeneratedTheme Theme to be used for generated items
.text TextTheme Text theme
Source:
Type:
  • Object

Triggers

Triggers
Properties:
Name Type Attributes Description
exportContent Array.<String> Supported triggers for exporting content.
addStrokes Array.<String> <optional>
Supported triggers for adding strokes.
Source:
Type:
  • Object

UndoRedoContext

Undo/redo context
Properties:
Name Type Default Description
stack Array.<Model> [ List of processed models.
currentPosition Number -1 Current model index into the stack.
maxSize Number Max size of the stack.
canUndo Boolean false
canRedo Boolean false
Source:
Type:
  • Object

UndoRedoManager

Undo/redo manager
Properties:
Name Type Description
updateModel function Push the current model into the undo/redo context.
undo function Undo.
redo function Redo.
clear function Clear.
Source:
Type:
  • Object