Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

iink-ts

MyScript3.9kApache-2.03.0.2TypeScript support: included

iinkTS is the fastest way to integrate handwriting panel and recognition in your webapp

myscript, javascript, typescript, developer, handwriting, recognition, cloud, iink

readme

iinkTS

npm version Examples Documentation

The fastest way to integrate rich handwriting features in your webapp.

:point_right: Examples:point_left:

iinkTS is a TypeScript library that can be used in every web application to bring handwriting recognition.

It integrates all you need:

  • Signal capture for all devices,
  • Digital ink rendering,
  • Link to MyScript Cloud to bring handwriting recognition.

Table of contents

Features

  • Text and Math support,
  • Easy to integrate,
  • Digital ink capture and rendering,
  • Rich editing gestures,
  • Import and export content,
  • Styling,
  • Typeset support,
  • More than 200 mathematical symbols supported,
  • 72 supported languages.

You can discover all the features on our Developer website for Text and Math.

Requirements

  1. Have npm, yarn.
  2. Have a MyScript developer account. You can create one here.
  3. Get your keys and the free monthly quota to access MyScript Cloud at developer.myscript.com

Installation

iinkTS can be installed with the well known package managers npm, yarn.

If you want to use npm or yarn you first have to init a project (or use an existing one).

npm init
OR
yarn init

You can then install iinkTS and use it as showed in the Usage section.

npm install iink-ts
OR
yarn add iink-ts

Usage

  1. Create an index.html file in the same directory.

  2. Add the following lines in the head section of your file to use iinkTS and the css :

    <script src="node_modules/iink-ts/dist/iink.min.js"></script>
  3. Still in the head section, add a style and specify the height and the width of your editor:

    <style>
     #editor {
         width: 100%;
         height: 100%;
     }
    </style>
  4. In the body tag, create a div tag that will contain the editing area:

     <div id="editor"></div>
  5. In JavaScript and within a <script> tag placed before the closing </body> tag, create the editor using the load function of the editor, your html editor element, the type of editor desired and the possible options depending on the type of editor then initialize it:

     const editorElement = document.getElementById('editor');
    
     const editor = await iink.Editor.load(editorElement, "INTERACTIVEINK", /* or INTERACTIVEINKSSR or INKV1 or INKV2*/
     {
         configuration: {
             server: {
                 applicationKey: '#YOUR MYSCRIPT DEVELOPER APPLICATION KEY#',
                 hmacKey: '#YOUR MYSCRIPT DEVELOPER HMAC KEY#'
             }
         }
     });
  6. Your index.html file should look like this:

    <html>
     <head>
         <script src="node_modules/iink-ts/dist/iink.min.js"></script>
         <style>
             #editor {
                 width: 100%;
                 height: 100%;
             }
         </style>
     </head>
     <body>
         <div id="editor"></div>
         <script>
             const editorElement = document.getElementById('editor');
    
             const editor = await iink.Editor.load(editorElement, "INTERACTIVEINK", /* or INTERACTIVEINKSSR or INKV1 or INKV2 */
             {
                 configuration: {
                     server: {
                         applicationKey: '#YOUR MYSCRIPT DEVELOPER APPLICATION KEY#',
                         hmacKey: '#YOUR MYSCRIPT DEVELOPER HMAC KEY#'
                     }
                 }
             });
         </script>
     </body>
    </html>
  7. Open index.html in your browser or serve your folder content using any web server.

You can find this guide, and a more complete example on the MyScript Developer website.

Documentation

You can find a complete documentation with the following sections on our Developer website:

We also provide a complete API Reference.

Development

Instructions to help you build the project and develop are available in the SETUP.md file.

Getting support

You can get support and ask your questions on the dedicated section of MyScript Developer website.

Sharing your feedback ?

Made a cool app with iinkTS? We would love to hear about you! We’re planning to showcase apps using it so let us know by sending a quick mail to myapp@myscript.com.

Contributing

We welcome your contributions: if you would like to extend iinkTS for your needs, feel free to fork it!

Please take a look at our contributing guidelines before submitting your pull request.

Troubleshooting

If you encounter the error: Unrecognized property: convert.force, this means your server version is lower than 2.3.0. To correct the problem, you have 2 options:

  • either update your server
  • either add in the iink-ts configuration configuration.server.info.version = 2.2.0

If you encounter the error: Unrecognized property: configuration.export.jiix.text.lines, this means your server version is lower than 3.2.0. To correct the problem, you have 2 options:

  • either update your server
  • either add in the iink-ts configuration configuration.server.info.version = 3.1.0

License

This library is licensed under the Apache 2.0.

changelog

v3.0

Features

  • configuration update
    • added classification to raw-content
    • added base lines on jiix
  • can resize edges by vertices
  • sync strokes with jiix element continuously

Refactor

  • replacing the editor constructor with an editor loader
  • delete global configuration, definition of specific configuration per editor
  • changing editor instantiation, split editor into separate editors
  • centralize layers
  • centralize event, rename intention to tool
  • separation of smart guide style into a specific file
  • separation of menu style into a specific file

Bugs fix

  • fix(Grabber) prevents the pointer cancel for touch event
  • fix(Convert) misalignment when converting text
  • fix(Interact) keep cursor during shape transformation
  • fix(Behaviors) fix change langage to reset init promise and raise event loaded
  • fix(RestBehaviors) missing exported event when export function ended

Samples

  • updating the display of exchanged Websocket messages on TLDraw example

Chore

  • chore(deps): upgrade all dependencies

v2.0.1

Features

  • feat(example) add underline & strikethrought gestures on tldraw example
  • feat(example) add possibility to disable gesture on tldraw example

Bugs fix

  • fix(Convert) converted word in a group with a stroke disappears after conversion - IIC-1215
  • fix(Gesture) don't send contextLessGesture if stroke not overlaps symbol
  • fix(examples) wrong placement of text after convert in tldraw example
  • fix(examples) style broken on websocket_text_customize_editor_css.html

v2.0.0

Features

  • offscreen behaviors

Refactor

  • [suggestion] friendly type declaration #4

v1.0.5

Refactor

  • use the native Crypto module instead of the crypto-js library as the library is no longer maintained #3
  • split examples css files
  • redesign of the examples homepage style

Bugs fix

  • fix(SmartGuide) it is possible to write just next to the ellipsis
  • fix(WSBehaviors) add stroke to model when importPointEvents

v1.0.4

Bugs fix

  • fix(Types) not all types are exported for development
  • fix(Model) clear export when strokes changed
  • fix(README.md) installing iink-ts from github using readme fails
  • fix(install) npm install error after git clone
  • fix(style) Editor styles unavailable in shadow dom elements #2
  • fix(Convert) Server state randomly corrupts and collapses the iink editor content #1
  • fix(examples) math examples don't give result when katex fails

    v1.0.3

Samples

  • sample Math with graph

Bugs fix

  • fix(Style) wrong import for custom grabber & custom recognizer

v1.0.2

Samples

  • sample custom grabber for websocket & REST
  • sample custom recognizer for websocket & REST
  • sample digram REST

Refactor

  • renaming redraw function to importPointEvents

Chore

  • chore(deps): upgrade crypto-js 3.3.0 -> 4.2.0

Bugs fix

  • fix(Stroke) generate uniqId
  • fix(Sample) wrong import into dev sample

v1.0.1

Features

  • can redraw JIIX export

Bugs fix

  • fix(Smartguide) hide if no export JIIX

    v1.0.0

Features

  • migration javascript to typescript link