├── .babelrc
├── preview.gif
├── docs
├── preview.gif
├── image
│ ├── search.png
│ ├── esdoc-logo-mini.png
│ ├── esdoc-logo-mini-black.png
│ ├── badge.svg
│ └── manual-badge.svg
├── script
│ ├── patch-for-local.js
│ ├── manual.js
│ ├── pretty-print.js
│ ├── inherited-summary.js
│ ├── inner-link.js
│ └── test-summary.js
├── css
│ ├── identifiers.css
│ ├── source.css
│ ├── test.css
│ ├── github.css
│ ├── search.css
│ ├── prettify-tomorrow.css
│ └── manual.css
├── badge.svg
└── lint.json
├── config
├── rollup.config.build.js
├── rollup.config.dev.js
└── rollup.config.js
├── test
├── nightwatch
│ ├── commands
│ │ ├── listenEditor.js
│ │ ├── waitForIdle.js
│ │ ├── getProperty.js
│ │ ├── getNumberOfSpans.js
│ │ ├── getJiixExports.js
│ │ ├── setProperty.js
│ │ ├── waitUntilElementPropertyEqual.js
│ │ ├── playStrokes.js
│ │ └── waitUntil.js
│ ├── full
│ │ ├── 01-rest
│ │ │ ├── 03-shape-rest-cdkv3.js
│ │ │ ├── 04-music-rest-cdkv3.js
│ │ │ ├── 05-analyzer-rest-cdkv3.js
│ │ │ ├── 06-rawContent-rest-full-cdkv4.js
│ │ │ ├── 02-text-rest-full-cdkv3.js
│ │ │ └── 01-math-rest-full-cdkv3.js
│ │ ├── 02-websocket
│ │ │ ├── 03-math-ws-full-cdkv4.js
│ │ │ ├── 02-text-ws-full-cdkv3.js
│ │ │ └── 01-math-ws-full-cdkv3.js
│ │ └── 00-env
│ │ │ └── 00-websocket-test.js
│ ├── partial
│ │ ├── 01-rest-v3
│ │ │ ├── 03-shape-rest-cdkv3.js
│ │ │ ├── 04-music-rest-cdkv3.js
│ │ │ ├── 05-analyzer-rest-cdkv3.js
│ │ │ ├── 02-text-rest-cdkv3.js
│ │ │ └── 01-math-rest-cdkv3.js
│ │ ├── 03-iink
│ │ │ ├── 05-textRAB-iink-ws-cdkv4.js
│ │ │ ├── 04-mathRAB-iink-ws-cdkv4.js
│ │ │ ├── 03-text-iink-rest-cdkv4.js
│ │ │ ├── 02-text-iink-ws-cdkv4.js
│ │ │ └── 01-math-iink-ws-cdkv4.js
│ │ └── 02-websocket-v3
│ │ │ ├── 02-text-ws-cdkv3.js
│ │ │ └── 01-math-ws-cdkv3.js
│ └── local-configuration.json
├── mocha
│ └── partial
│ │ ├── CryptoHelper.spec.babel.js
│ │ ├── 00-configuration
│ │ ├── LoggerConfig.spec.babel.js
│ │ ├── Constants.spec.babel.js
│ │ ├── DefaultConfiguration.spec.babel.js
│ │ └── DefaultBehaviors.spec.babel.js
│ │ ├── 02-behaviors
│ │ └── PointerEventGrabber.spec.babel.js
│ │ ├── ModelStats.spec.babel.js
│ │ └── 01-model
│ │ ├── UndoRedoManager.spec.babel.js
│ │ ├── StrokeComponent.spec.babel.js
│ │ └── InkModel.spec.babel.js
└── lib
│ └── inks
│ ├── one.json
│ ├── hello.json
│ ├── rabText.json
│ ├── equation.json
│ └── equation3.json
├── .gitignore
├── index.html
├── docker
└── examples
│ ├── createIndexFile.sh
│ ├── Dockerfile
│ └── nginx.conf
├── .esdoc.json
├── assets
├── vue.svg
├── angular.svg
└── react.svg
├── src
├── renderer
│ ├── svg
│ │ └── symbols
│ │ │ └── StrokeSymbolSVGRenderer.js
│ ├── canvas
│ │ ├── symbols
│ │ │ ├── StrokeSymbolCanvasRenderer.js
│ │ │ ├── MathSymbolCanvasRenderer.js
│ │ │ └── TextSymbolCanvasRenderer.js
│ │ └── ImageRenderer.js
│ └── QuadraticUtils.js
├── util
│ ├── PromiseHelper.js
│ └── ModelStats.js
├── callback
│ └── EventCallback.js
├── recognizer
│ ├── CryptoHelper.js
│ ├── common
│ │ ├── v3
│ │ │ ├── Cdkv3CommonTextRecognizer.js
│ │ │ ├── Cdkv3CommonMathRecognizer.js
│ │ │ └── Cdkv3CommonShapeRecognizer.js
│ │ └── CdkCommonUtil.js
│ └── rest
│ │ └── v3
│ │ ├── Cdkv3RestRecognizerUtil.js
│ │ ├── Cdkv3RestTextRecognizer.js
│ │ └── Cdkv3RestMathRecognizer.js
├── myscript.js
├── model
│ └── UndoRedoContext.js
├── EditorFacade.js
├── configuration
│ ├── DefaultPenStyle.js
│ ├── LoggerConfig.js
│ ├── languagesV3.json
│ ├── languages.json
│ ├── DefaultTheme.js
│ └── Constants.js
└── eastereggs
│ └── InkImporter.js
├── CONTRIBUTING.md
├── LICENSE
├── .editorconfig
├── .eslintrc.json
├── examples
├── assets
│ └── img
│ │ ├── redo.svg
│ │ ├── undo.svg
│ │ ├── plus.svg
│ │ ├── edit.svg
│ │ ├── clear.svg
│ │ └── document.svg
├── non-version-specific
│ ├── handle_errors.html
│ └── change_language.html
├── v4
│ ├── multiple_inputs.html
│ ├── rest
│ │ └── diagram.css
│ ├── custom_resources_text.html
│ ├── import_content.html
│ ├── custom_lexicon_text.html
│ ├── websocket_text_iink.html
│ ├── websocket_text_iink_no_guides.html
│ ├── websocket_text_iink_decoration.html
│ └── pointer_events.html
├── experimental
│ ├── rest_analyzer_cdk32.html
│ ├── rest_shape.html
│ └── rest_music_cdk32.html
└── v3
│ ├── rest_math.html
│ └── websocket_math.html
├── dev
└── AIRBNB.xml
├── SETUP.md
├── Jenkinsfile
├── package.json
└── Makefile.inc
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | [
4 | "env"
5 | ]
6 | ]
7 | }
--------------------------------------------------------------------------------
/preview.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyScript/MyScriptJS/HEAD/preview.gif
--------------------------------------------------------------------------------
/docs/preview.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyScript/MyScriptJS/HEAD/docs/preview.gif
--------------------------------------------------------------------------------
/docs/image/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyScript/MyScriptJS/HEAD/docs/image/search.png
--------------------------------------------------------------------------------
/config/rollup.config.build.js:
--------------------------------------------------------------------------------
1 | import config from './rollup.config';
2 |
3 | export default config;
4 |
--------------------------------------------------------------------------------
/docs/image/esdoc-logo-mini.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyScript/MyScriptJS/HEAD/docs/image/esdoc-logo-mini.png
--------------------------------------------------------------------------------
/docs/image/esdoc-logo-mini-black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MyScript/MyScriptJS/HEAD/docs/image/esdoc-logo-mini-black.png
--------------------------------------------------------------------------------
/test/nightwatch/commands/listenEditor.js:
--------------------------------------------------------------------------------
1 | exports.command = function listenEditor(done) {
2 | this.injectScript('/examples/dev/tests/editorSupervisor.js', 'customScript', done);
3 | };
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules/
2 | **/*.iml
3 | **/*.idea/
4 | /bower_components/
5 | **/*/delivery/
6 | /test/**/*.xml
7 | /test/mocha/results/
8 | /test/nightwatch/results/
9 | /test/webdriverio/results/
10 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Title
6 |
7 |
8 |
9 |
10 |
13 |
--------------------------------------------------------------------------------
/docs/script/patch-for-local.js:
--------------------------------------------------------------------------------
1 | (function(){
2 | if (location.protocol === 'file:') {
3 | var elms = document.querySelectorAll('a[href="./"]');
4 | for (var i = 0; i < elms.length; i++) {
5 | elms[i].href = './index.html';
6 | }
7 | }
8 | })();
9 |
--------------------------------------------------------------------------------
/docker/examples/createIndexFile.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -e
4 |
5 | echo "
6 |
7 | MyScript JS examples
8 |
9 |
10 |
11 |
12 |
13 | " > /usr/share/nginx/html/index.html
14 |
--------------------------------------------------------------------------------
/.esdoc.json:
--------------------------------------------------------------------------------
1 | {
2 | "source": "./src",
3 | "destination": "./docs",
4 | "plugins": [
5 | {
6 | "name": "esdoc-standard-plugin",
7 | "option": {
8 | "manual": {
9 | "index": "./CHANGELOG.md",
10 | "asset": "",
11 | "files": []
12 | }
13 | }
14 | }
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/assets/vue.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/renderer/svg/symbols/StrokeSymbolSVGRenderer.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Draw a stroke symbol
3 | * @param {Object} context Current rendering context
4 | * @param {Stroke} stroke Stroke to be drawn
5 | * @param {Stroker} stroker Stroker to use to render a stroke
6 | */
7 | export function drawStroke(context, stroke, stroker) {
8 | if (stroker) {
9 | stroker.drawStroke(context, stroke);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/renderer/canvas/symbols/StrokeSymbolCanvasRenderer.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Draw a stroke symbol
3 | * @param {Object} context Current rendering context
4 | * @param {Stroke} stroke Stroke to be drawn
5 | * @param {Stroker} stroker Stroker to use to render a stroke
6 | */
7 | export function drawStroke(context, stroke, stroker) {
8 | if (stroker) {
9 | stroker.drawStroke(context, stroke);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/test/nightwatch/commands/waitForIdle.js:
--------------------------------------------------------------------------------
1 | exports.command = function waitForIdle(element, timeout, callback) {
2 | function waitForEditorIdle(client, done) {
3 | client
4 | .click('#waitForIdle')
5 | .waitUntilElementPropertyEqual(element, 'idle', true, timeout, done);
6 | }
7 |
8 | this.perform(waitForEditorIdle);
9 |
10 | if (typeof callback === 'function') {
11 | callback.call(this);
12 | }
13 | return this;
14 | };
15 |
--------------------------------------------------------------------------------
/docker/examples/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM nginx:stable-alpine
2 |
3 | COPY nginx.conf /etc/nginx/nginx.conf
4 | COPY delivery /usr/share/nginx/html
5 | COPY *.sh /
6 | RUN chmod a+x /entrypoint.sh
7 |
8 | RUN /createIndexFile.sh
9 |
10 | ENV LISTEN_PORT 80
11 | ENV APISCHEME "https"
12 | ENV APIHOST "webdemoapi.myscript.com"
13 | ARG applicationkey
14 | ARG hmackey
15 | ENV DEV_APPLICATIONKEY=$applicationkey
16 | ENV DEV_HMACKEY=$hmackey
17 |
18 | ENTRYPOINT ["/entrypoint.sh"]
19 |
--------------------------------------------------------------------------------
/assets/angular.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/script/manual.js:
--------------------------------------------------------------------------------
1 | (function(){
2 | var matched = location.pathname.match(/\/(manual\/.*\.html)$/);
3 | if (!matched) return;
4 |
5 | var currentName = matched[1];
6 | var cssClass = '.navigation .manual-toc li[data-link="' + currentName + '"]';
7 | var styleText = cssClass + '{ display: block; }\n';
8 | styleText += cssClass + '.indent-h1 a { color: #039BE5 }';
9 | var style = document.createElement('style');
10 | style.textContent = styleText;
11 | document.querySelector('head').appendChild(style);
12 | })();
13 |
--------------------------------------------------------------------------------
/test/mocha/partial/CryptoHelper.spec.babel.js:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'mocha';
2 | import { assert } from 'chai';
3 | import * as CryptoHelper from '../../../src/recognizer/CryptoHelper';
4 |
5 | describe('Hmac computation test', () => {
6 | it('nominal case', () => {
7 | const computedHmac = CryptoHelper.computeHmac('Message', 'Key');
8 | assert.equal(computedHmac, '7a2d9a9ad584ccbb3c110bf4e94d8dfef284eb258da89b2aeb01c43fa7e9d719a2b765af3f208f62ed36723d9562b9fe68a9f7e38b49e2ae6558deadcb274d8f');
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/test/nightwatch/full/01-rest/03-shape-rest-cdkv3.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('SHAPE', 'REST', 'V3');
3 |
4 | function runInkTests(ink) {
5 | module.exports[config.header + ' checkUndoRedo ' + ink.name] = function checkUndoRedo(browser) {
6 | inkPlayer.checkUndoRedo(browser, config, ink.strokes, ink.exports.SEGMENTS, '#editor', '[data-key=SEGMENTS]');
7 | };
8 | }
9 |
10 | config.inks
11 | .forEach(ink => runInkTests(ink));
12 |
--------------------------------------------------------------------------------
/test/nightwatch/full/01-rest/04-music-rest-cdkv3.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('MUSIC', 'REST', 'V3');
3 |
4 | function runInkTests(ink) {
5 | module.exports[config.header + ' checkUndoRedo ' + ink.name] = function checkUndoRedo(browser) {
6 | inkPlayer.checkUndoRedo(browser, config, ink.strokes, ink.exports.MUSICXML, '#editor', '[data-key=MUSICXML]');
7 | };
8 | }
9 |
10 | config.inks
11 | .forEach(ink => runInkTests(ink));
12 |
--------------------------------------------------------------------------------
/test/nightwatch/full/01-rest/05-analyzer-rest-cdkv3.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('ANALYZER', 'REST', 'V3');
3 |
4 | function runInkTests(ink) {
5 | module.exports[config.header + ' checkUndoRedo ' + ink.name] = function checkUndoRedo(browser) {
6 | inkPlayer.checkUndoRedo(browser, config, ink.strokes, ink.exports.ANALYSIS, '#editor', '[data-key=ANALYSIS]');
7 | };
8 | }
9 |
10 | config.inks
11 | .forEach(ink => runInkTests(ink));
12 |
--------------------------------------------------------------------------------
/test/nightwatch/commands/getProperty.js:
--------------------------------------------------------------------------------
1 | exports.command = function getProperty(element, property, callback) {
2 | const self = this;
3 |
4 | function getElementProperty(el, prop) {
5 | // eslint-disable-next-line no-undef
6 | return document.querySelector(el)[prop];
7 | }
8 |
9 | function getElementPropertyCallback(res) {
10 | if (typeof callback === 'function') {
11 | callback.call(self, res);
12 | }
13 | }
14 |
15 | this.execute(getElementProperty, [element, property], getElementPropertyCallback);
16 | return this;
17 | };
18 |
--------------------------------------------------------------------------------
/test/nightwatch/commands/getNumberOfSpans.js:
--------------------------------------------------------------------------------
1 | exports.command = function getNumberOfSpans(element, callback) {
2 | const self = this;
3 |
4 | function getNumberOfSpansFunc(el) {
5 | // eslint-disable-next-line no-undef
6 | return document.querySelector(el).getElementsByTagName('span').length;
7 | }
8 |
9 | function getNumberOfSpansCallback(res) {
10 | if (typeof callback === 'function') {
11 | callback.call(self, res);
12 | }
13 | }
14 |
15 | this.execute(getNumberOfSpansFunc, [element], getNumberOfSpansCallback);
16 | return this;
17 | };
18 |
--------------------------------------------------------------------------------
/src/util/PromiseHelper.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @typedef {Object} DestructuredPromise
3 | * @property {Promise} promise
4 | * @property {function(value: Object)} resolve
5 | * @property {function(reason: Object)} reject
6 | */
7 |
8 | /**
9 | * @return {DestructuredPromise}
10 | */
11 | export function destructurePromise() {
12 | let resolve;
13 | let reject;
14 | const initPromise = new Promise(
15 | (resolveParam, rejectParam) => {
16 | resolve = resolveParam;
17 | reject = rejectParam;
18 | });
19 | return { promise: initPromise, resolve, reject };
20 | }
21 |
--------------------------------------------------------------------------------
/test/nightwatch/partial/01-rest-v3/03-shape-rest-cdkv3.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('SHAPE', 'REST', 'V3');
3 |
4 | function runInkTests(ink) {
5 | module.exports[config.header + ' checkUndoRedo ' + ink.name] = function checkUndoRedo(browser) {
6 | inkPlayer.checkUndoRedo(browser, config, ink.strokes, ink.exports.SEGMENTS, '#editor', '[data-key=SEGMENTS]');
7 | };
8 | }
9 |
10 | config.inks
11 | .filter(ink => ['shape'].includes(ink.name))
12 | .forEach(ink => runInkTests(ink));
13 |
--------------------------------------------------------------------------------
/test/nightwatch/partial/01-rest-v3/04-music-rest-cdkv3.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('MUSIC', 'REST', 'V3');
3 |
4 | function runInkTests(ink) {
5 | module.exports[config.header + ' checkUndoRedo ' + ink.name] = function checkUndoRedo(browser) {
6 | inkPlayer.checkUndoRedo(browser, config, ink.strokes, ink.exports.MUSICXML, '#editor', '[data-key=MUSICXML]');
7 | };
8 | }
9 |
10 | config.inks
11 | .filter(ink => ['music'].includes(ink.name))
12 | .forEach(ink => runInkTests(ink));
13 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | We gladly welcome pull requests to MyScriptJS. If you have any questions, or need help to solve a problem, feel free to stop by the [MyScript forum](https://developer-support.myscript.com/support/discussions/forums/16000096021).
4 |
5 | ## CLA
6 |
7 | In order to contribute, you must first agree to the **Contributor License Agreement** available [here](http://goo.gl/forms/YyzZ9VSvYG).
8 |
9 | Make sure you read the article "[Contributing to Open Source on GitHub](https://guides.github.com/activities/contributing-to-open-source/)" to understand the contributing process.
--------------------------------------------------------------------------------
/src/callback/EventCallback.js:
--------------------------------------------------------------------------------
1 | import { callbackLogger as logger } from '../configuration/LoggerConfig';
2 |
3 | /**
4 | * Emits an event when the editor state change
5 | * @param {String} type
6 | * @param {Object} data
7 | * @emits {Event}
8 | */
9 | export default function eventCallback(type, data) {
10 | logger.info(`emitting ${type} event`, data);
11 | // We are making usage of a browser provided class
12 | // eslint-disable-next-line no-undef
13 | this.dispatchEvent(new CustomEvent(type, Object.assign({ bubbles: true, composed: true }, data ? { detail: data } : undefined)));
14 | }
15 |
--------------------------------------------------------------------------------
/test/nightwatch/commands/getJiixExports.js:
--------------------------------------------------------------------------------
1 | exports.command = function getJiixExports(component, callback) {
2 | const self = this;
3 |
4 | function getElementProperty(comp) {
5 | // eslint-disable-next-line no-undef
6 | return document.querySelector(comp).editor.model.exports['application/vnd.myscript.jiix'];
7 | }
8 |
9 | function getElementPropertyCallback(res) {
10 | if (typeof callback === 'function') {
11 | callback.call(self, res);
12 | }
13 | }
14 |
15 | this.execute(getElementProperty, [component], getElementPropertyCallback);
16 | return this;
17 | };
18 |
--------------------------------------------------------------------------------
/test/nightwatch/partial/01-rest-v3/05-analyzer-rest-cdkv3.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('ANALYZER', 'REST', 'V3');
3 |
4 | function runInkTests(ink) {
5 | module.exports[config.header + ' checkUndoRedo ' + ink.name] = function checkUndoRedo(browser) {
6 | inkPlayer.checkUndoRedo(browser, config, ink.strokes, ink.exports.ANALYSIS, '#editor', '[data-key=ANALYSIS]');
7 | };
8 | }
9 |
10 | config.inks
11 | .filter(ink => ['fourSquare'].includes(ink.name))
12 | .forEach(ink => runInkTests(ink));
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright MyScript.
2 | Licensed under the Apache License, Version 2.0 (the "License");
3 | you may not use this file except in compliance with the License.
4 | You may obtain a copy of the License at
5 | http://www.apache.org/licenses/LICENSE-2.0
6 | Unless required by applicable law or agreed to in writing, software
7 | distributed under the License is distributed on an "AS IS" BASIS,
8 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9 | See the License for the specific language governing permissions and
10 | limitations under the License.
11 |
--------------------------------------------------------------------------------
/test/nightwatch/commands/setProperty.js:
--------------------------------------------------------------------------------
1 | exports.command = function setProperty(element, property, value, callback) {
2 | const self = this;
3 |
4 | function setElementProperty(el, prop, val) {
5 | // eslint-disable-next-line no-undef
6 | document.querySelector(el)[prop] = val;
7 | return val;
8 | }
9 |
10 | function setElementPropertyCallback(result) {
11 | if (typeof callback === 'function') {
12 | callback.call(self, result);
13 | }
14 | }
15 |
16 | this.execute(setElementProperty, [element, property, value], setElementPropertyCallback);
17 | return this;
18 | };
19 |
--------------------------------------------------------------------------------
/config/rollup.config.dev.js:
--------------------------------------------------------------------------------
1 | import serve from 'rollup-plugin-serve';
2 | import livereload from 'rollup-plugin-livereload';
3 | import config from './rollup.config';
4 |
5 | config[0].plugins.push(
6 | serve({
7 | open: true,
8 | verbose: true,
9 | contentBase: '',
10 | host: 'localhost',
11 | port: 8080,
12 | headers: {
13 | 'Access-Control-Allow-Origin': '*',
14 | }
15 | }),
16 | livereload({
17 | watch: [
18 | 'dist',
19 | 'examples'
20 | ]
21 | })
22 | );
23 |
24 | config.watch = {
25 | include: 'src/**'
26 | };
27 |
28 | export default config;
29 |
--------------------------------------------------------------------------------
/test/nightwatch/full/01-rest/06-rawContent-rest-full-cdkv4.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('Raw Content', 'REST', 'V4');
3 |
4 | function runInkTests(ink) {
5 | module.exports[config.header + ' checkRawContent ' + ink.name] = function checkRawContent(browser) {
6 | inkPlayer.checkRawContent(browser, config, ink.strokes, '#editor', '[data-key="application/vnd.myscript.jiix"]');
7 | };
8 | };
9 |
10 | config.inks
11 | //.filter(ink => ['fourSquare'].includes(ink.name))
12 | .forEach(ink => runInkTests(ink));
13 |
--------------------------------------------------------------------------------
/test/nightwatch/commands/waitUntilElementPropertyEqual.js:
--------------------------------------------------------------------------------
1 | exports.command = function waitUntilPropertyEqual(element, property, expected, timeout, callback) {
2 | const browser = this;
3 |
4 | function getActualValue(done) {
5 | browser.getProperty(element, property, (value) => {
6 | done(value);
7 | });
8 | }
9 |
10 | function predicate(actual) {
11 | return (expected === actual);
12 | }
13 |
14 | return browser.waitUntil(getActualValue, predicate, timeout, (result) => {
15 | if (typeof callback === 'function') {
16 | callback.call(browser, result);
17 | }
18 | });
19 | };
20 |
--------------------------------------------------------------------------------
/test/nightwatch/full/02-websocket/03-math-ws-full-cdkv4.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('MATH', 'WEBSOCKET', 'V4');
3 |
4 | function runInkTests(ink) {
5 | module.exports[config.header + ' checkAlwaysConnected ' + ink.name] = function checkLabels(browser) {
6 | inkPlayer.checkAlwaysConnected(browser, config, ink.strokes, ink.exports.LATEX, '#editor', '[data-key="application/x-latex"]');
7 | }
8 | }
9 |
10 | config.inks
11 | .filter(ink => ['equation3'].includes(ink.name))
12 | .forEach(ink => runInkTests(ink));
13 |
--------------------------------------------------------------------------------
/test/nightwatch/partial/03-iink/05-textRAB-iink-ws-cdkv4.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('TEXT', 'WEBSOCKET', 'V4', '', 'RAB');
3 |
4 | function runRecognitionAssetBuilderTest(ink) {
5 | module.exports[config.header + ' CheckRecognitionAssetBuilder ' + ink.name] = function CheckRecognitionAssetBuilder(browser) {
6 | inkPlayer.checkRecognitionAssetBuilder(browser, config, ink.strokes, ink.exports.TEXT, '#editor', '[data-key="text/plain"]');
7 | };
8 | }
9 |
10 | config.inks
11 | .filter(ink => ['rabText'].includes(ink.name))
12 | .forEach(ink => runRecognitionAssetBuilderTest(ink))
13 |
--------------------------------------------------------------------------------
/test/nightwatch/partial/03-iink/04-mathRAB-iink-ws-cdkv4.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('MATH', 'WEBSOCKET', 'V4', '', 'RAB');
3 |
4 | function runRecognitionAssetBuilderTest(ink) {
5 | module.exports[config.header + ' CheckRecognitionAssetBuilder ' + ink.name] = function CheckRecognitionAssetBuilder(browser) {
6 | inkPlayer.checkRecognitionAssetBuilder(browser, config, ink.strokes, ink.exports.LATEX, '#editor', '[data-key="application/x-latex"]');
7 | };
8 | }
9 |
10 | config.inks
11 | .filter(ink => ['3times2'].includes(ink.name))
12 | .forEach(ink => runRecognitionAssetBuilderTest(ink))
13 |
--------------------------------------------------------------------------------
/test/mocha/partial/00-configuration/LoggerConfig.spec.babel.js:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'mocha';
2 | import { assert } from 'chai';
3 | import * as loggers from '../../../../src/configuration/LoggerConfig';
4 |
5 | describe('Check loggers definition and initialization', () => {
6 | it('module is define', () => {
7 | assert.notEqual(loggers, undefined);
8 | });
9 |
10 | const loggerList = ['grabber', 'editor', 'renderer', 'model', 'recognizer', 'test', 'util'];
11 | loggerList.forEach((loggerName) => {
12 | const logger = loggers[`${loggerName}Logger`];
13 |
14 | it(`${loggerName}Logger is define`, () => {
15 | assert.notEqual(logger, undefined);
16 | });
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/test/nightwatch/full/01-rest/02-text-rest-full-cdkv3.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('TEXT', 'REST', 'V3');
3 |
4 | function runInkTests(ink) {
5 | module.exports[config.header + ' checkLabels ' + ink.name] = function checkLabels(browser) {
6 | inkPlayer.checkLabels(browser, config, ink.strokes, ink.exports.TEXT, '#editor', '[data-key=TEXT]');
7 | };
8 |
9 | module.exports[config.header + ' checkUndoRedo ' + ink.name] = function checkUndoRedo(browser) {
10 | inkPlayer.checkUndoRedo(browser, config, ink.strokes, ink.exports.TEXT, '#editor', '[data-key=TEXT]');
11 | };
12 | }
13 |
14 | config.inks
15 | .forEach(ink => runInkTests(ink));
16 |
--------------------------------------------------------------------------------
/test/nightwatch/full/02-websocket/02-text-ws-full-cdkv3.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('TEXT', 'WEBSOCKET', 'V3');
3 |
4 | function runInkTests(ink) {
5 | module.exports[config.header + ' checkLabels ' + ink.name] = function checkLabels(browser) {
6 | inkPlayer.checkLabels(browser, config, ink.strokes, ink.exports.TEXT, '#editor', '[data-key=TEXT]');
7 | };
8 |
9 | module.exports[config.header + ' checkUndoRedo ' + ink.name] = function checkUndoRedo(browser) {
10 | inkPlayer.checkUndoRedo(browser, config, ink.strokes, ink.exports.TEXT, '#editor', '[data-key=TEXT]');
11 | };
12 | }
13 |
14 | config.inks
15 | .forEach(ink => runInkTests(ink));
16 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | [*]
2 | charset=utf-8
3 | end_of_line=lf
4 | insert_final_newline=false
5 | indent_style=space
6 | indent_size=4
7 |
8 | [{.babelrc,.stylelintrc,.eslintrc,jest.config,*.json,*.jsb3,*.jsb2,*.bowerrc}]
9 | indent_style=space
10 | indent_size=2
11 |
12 | [{*.applejs,*.js,*.html}]
13 | indent_style=space
14 | indent_size=2
15 |
16 | [*.js.flow]
17 | indent_style=space
18 | indent_size=2
19 |
20 | [{jshint.json,*.jshintrc}]
21 | indent_style=space
22 | indent_size=2
23 |
24 | [{*.jscs.json,*.jscsrc}]
25 | indent_style=space
26 | indent_size=2
27 |
28 | [*.scss]
29 | indent_style=space
30 | indent_size=2
31 |
32 | [*.coffee]
33 | indent_style=space
34 | indent_size=2
35 |
36 | [{.analysis_options,*.yml,*.yaml}]
37 | indent_style=space
38 | indent_size=2
39 |
40 |
--------------------------------------------------------------------------------
/src/recognizer/CryptoHelper.js:
--------------------------------------------------------------------------------
1 | import Hex from 'crypto-js/enc-hex';
2 | import HmacSHA512 from 'crypto-js/hmac-sha512';
3 | import { recognizerLogger as logger } from '../configuration/LoggerConfig';
4 |
5 | /**
6 | * Compute HMAC signature for server authentication
7 | *
8 | * @param {Object} input Input data to compute HMAC
9 | * @param {String} applicationKey Current applicationKey
10 | * @param {String} hmacKey Current hmacKey
11 | * @return {String} Signature
12 | */
13 | export function computeHmac(input, applicationKey, hmacKey) {
14 | const jsonInput = (typeof input === 'object') ? JSON.stringify(input) : input;
15 | logger.debug('The HmacSHA512 function is loaded', HmacSHA512);
16 | return new HmacSHA512(jsonInput, applicationKey + hmacKey).toString(Hex);
17 | }
18 |
--------------------------------------------------------------------------------
/test/nightwatch/partial/01-rest-v3/02-text-rest-cdkv3.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('TEXT', 'REST', 'V3');
3 |
4 | function runInkTests(ink) {
5 | module.exports[config.header + ' checkLabels ' + ink.name] = function checkLabels(browser) {
6 | inkPlayer.checkLabels(browser, config, ink.strokes, ink.exports.TEXT, '#editor', '[data-key=TEXT]');
7 | };
8 |
9 | module.exports[config.header + ' checkUndoRedo ' + ink.name] = function checkUndoRedo(browser) {
10 | inkPlayer.checkUndoRedo(browser, config, ink.strokes, ink.exports.TEXT, '#editor', '[data-key=TEXT]');
11 | };
12 | }
13 |
14 | config.inks
15 | .filter(ink => ['hello'].includes(ink.name))
16 | .forEach(ink => runInkTests(ink));
17 |
--------------------------------------------------------------------------------
/test/nightwatch/partial/02-websocket-v3/02-text-ws-cdkv3.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('TEXT', 'WEBSOCKET', 'V3');
3 |
4 | function runInkTests(ink) {
5 | module.exports[config.header + ' checkLabels ' + ink.name] = function checkLabels(browser) {
6 | inkPlayer.checkLabels(browser, config, ink.strokes, ink.exports.TEXT, '#editor', '[data-key=TEXT]');
7 | };
8 |
9 | module.exports[config.header + ' checkUndoRedo ' + ink.name] = function checkUndoRedo(browser) {
10 | inkPlayer.checkUndoRedo(browser, config, ink.strokes, ink.exports.TEXT, '#editor', '[data-key=TEXT]');
11 | };
12 | }
13 |
14 | config.inks
15 | .filter(ink => ['hello'].includes(ink.name))
16 | .forEach(ink => runInkTests(ink));
17 |
--------------------------------------------------------------------------------
/docs/css/identifiers.css:
--------------------------------------------------------------------------------
1 | .identifiers-wrap {
2 | display: flex;
3 | align-items: flex-start;
4 | }
5 |
6 | .identifier-dir-tree {
7 | background: #fff;
8 | border: solid 1px #ddd;
9 | border-radius: 0.25em;
10 | top: 52px;
11 | position: -webkit-sticky;
12 | position: sticky;
13 | max-height: calc(100vh - 155px);
14 | overflow-y: scroll;
15 | min-width: 200px;
16 | margin-left: 1em;
17 | }
18 |
19 | .identifier-dir-tree-header {
20 | padding: 0.5em;
21 | background-color: #fafafa;
22 | border-bottom: solid 1px #ddd;
23 | }
24 |
25 | .identifier-dir-tree-content {
26 | padding: 0 0.5em 0;
27 | }
28 |
29 | .identifier-dir-tree-content > div {
30 | padding-top: 0.25em;
31 | padding-bottom: 0.25em;
32 | }
33 |
34 | .identifier-dir-tree-content a {
35 | color: inherit;
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/test/nightwatch/partial/03-iink/03-text-iink-rest-cdkv4.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('TEXT', 'REST', 'V4');
3 |
4 | function runInkTests(ink) {
5 | module.exports[config.header + ' checkLabels ' + ink.name] = function checkLabels(browser) {
6 | inkPlayer.checkLabels(browser, config, ink.strokes, ink.exports.TEXT, '#editor', '[data-key="text/plain"]');
7 | };
8 |
9 | module.exports[config.header + ' checkUndoRedo ' + ink.name] = function checkUndoRedo(browser) {
10 | inkPlayer.checkUndoRedo(browser, config, ink.strokes, ink.exports.TEXT, '#editor', '[data-key="text/plain"]');
11 | };
12 | }
13 |
14 | config.inks
15 | .filter(ink => ['hellov4rest'].includes(ink.name))
16 | .forEach(ink => runInkTests(ink));
17 |
--------------------------------------------------------------------------------
/src/recognizer/common/v3/Cdkv3CommonTextRecognizer.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Extract the exports
3 | * @param {Model} model Current model
4 | * @return {Object} exports
5 | */
6 | export function extractExports(model) {
7 | // We recopy the recognized strokes to flag them as toBeRemove if they are scratched out or map with a symbol
8 | if (model.rawResults &&
9 | model.rawResults.exports &&
10 | model.rawResults.exports.result &&
11 | model.rawResults.exports.result.textSegmentResult &&
12 | model.rawResults.exports.result.textSegmentResult.candidates) {
13 | return {
14 | CANDIDATES: model.rawResults.exports.result,
15 | TEXT: model.rawResults.exports.result.textSegmentResult.candidates[model.rawResults.exports.result.textSegmentResult.selectedCandidateIdx].label
16 | };
17 | }
18 | return {};
19 | }
20 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "airbnb",
3 | "parserOptions": {
4 | "ecmaVersion": 2017,
5 | "sourceType": "module",
6 | "ecmaFeatures": {
7 | "jsx": true
8 | }
9 | },
10 | "rules": {
11 | "semi": 2,
12 | "no-unused-vars" : "off",
13 | "comma-dangle" : "off",
14 | "no-plusplus" : "off",
15 | "no-restricted-properties" : "off",
16 | "prefer-template" : "off",
17 | "import/no-extraneous-dependencies" : "off",
18 | "import/prefer-default-export" : "off",
19 | "max-len": ["off", 100, 2, {
20 | "ignoreUrls": true,
21 | "ignoreComments": false,
22 | "ignoreStrings": true,
23 | "ignoreTemplateLiterals": true
24 | }]
25 | },
26 | "globals": {
27 | "document": true,
28 | "window": true,
29 | "Blob": true,
30 | "FileReader": true
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/docker/examples/nginx.conf:
--------------------------------------------------------------------------------
1 | user nginx;
2 | worker_processes 1;
3 | daemon off;
4 | error_log /var/log/nginx/error.log warn;
5 | pid /var/run/nginx.pid;
6 |
7 |
8 | events {
9 | worker_connections 1024;
10 | }
11 |
12 |
13 | http {
14 | include /etc/nginx/mime.types;
15 | default_type application/octet-stream;
16 |
17 | log_format main '$remote_addr - $remote_user [$time_local] "$request" '
18 | '$status $body_bytes_sent "$http_referer" '
19 | '"$http_user_agent" "$http_x_forwarded_for"';
20 |
21 | access_log /var/log/nginx/access.log main;
22 |
23 | sendfile off;
24 | expires 0;
25 | autoindex on;
26 | #tcp_nopush on;
27 |
28 | keepalive_timeout 65;
29 |
30 | #gzip on;
31 |
32 | include /etc/nginx/conf.d/*.conf;
33 | }
34 |
--------------------------------------------------------------------------------
/docs/badge.svg:
--------------------------------------------------------------------------------
1 |
18 |
--------------------------------------------------------------------------------
/examples/assets/img/redo.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/dev/AIRBNB.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/docs/image/badge.svg:
--------------------------------------------------------------------------------
1 |
18 |
--------------------------------------------------------------------------------
/docs/image/manual-badge.svg:
--------------------------------------------------------------------------------
1 |
18 |
--------------------------------------------------------------------------------
/examples/assets/img/undo.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/docs/script/pretty-print.js:
--------------------------------------------------------------------------------
1 | (function(){
2 | prettyPrint();
3 | var lines = document.querySelectorAll('.prettyprint.linenums li[class^="L"]');
4 | for (var i = 0; i < lines.length; i++) {
5 | lines[i].id = 'lineNumber' + (i + 1);
6 | }
7 |
8 | var matched = location.hash.match(/errorLines=([\d,]+)/);
9 | if (matched) {
10 | var lines = matched[1].split(',');
11 | for (var i = 0; i < lines.length; i++) {
12 | var id = '#lineNumber' + lines[i];
13 | var el = document.querySelector(id);
14 | el.classList.add('error-line');
15 | }
16 | return;
17 | }
18 |
19 | if (location.hash) {
20 | // ``[ ] . ' " @`` are not valid in DOM id. so must escape these.
21 | var id = location.hash.replace(/([\[\].'"@$])/g, '\\$1');
22 | var line = document.querySelector(id);
23 | if (line) line.classList.add('active');
24 | }
25 | })();
26 |
--------------------------------------------------------------------------------
/test/mocha/partial/02-behaviors/PointerEventGrabber.spec.babel.js:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'mocha';
2 | import { assert } from 'chai';
3 | import * as sinon from 'sinon';
4 | import { testLogger as logger } from '../../../../src/configuration/LoggerConfig';
5 | import * as grabber from '../../../../src/grabber/PointerEventGrabber';
6 |
7 | describe('Testing the Grabber', () => {
8 | it('Test event registration', () => {
9 | const spiedEditor = { pointerUp: sinon.spy(), configuration: { capture: true } };
10 | const spiedDomDocument = { addEventListener: sinon.spy() };
11 | logger.debug('Attaching document to spied element');
12 | grabber.attach(spiedDomDocument, spiedEditor);
13 |
14 | assert.strictEqual(spiedDomDocument.addEventListener.callCount, 6, 'Not all events have been registered');
15 | });
16 |
17 | // TODO Add some tests sending events and checking that grabber behave as expected
18 | });
19 |
--------------------------------------------------------------------------------
/test/nightwatch/full/01-rest/01-math-rest-full-cdkv3.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('MATH', 'REST', 'V3');
3 |
4 | function runLabelsTests(ink) {
5 | module.exports[config.header + ' checkLabels ' + ink.name] = function checkLabels(browser) {
6 | inkPlayer.checkLabels(browser, config, ink.strokes, ink.exports.LATEX, '#editor', '[data-key=LATEX]');
7 | };
8 | }
9 |
10 | function runUndoTests(ink) {
11 | module.exports[config.header + ' checkUndoRedo ' + ink.name] = function checkUndoRedo(browser) {
12 | inkPlayer.checkUndoRedo(browser, config, ink.strokes, ink.exports.LATEX, '#editor', '[data-key=LATEX]');
13 | };
14 | }
15 |
16 | // config.inks
17 | // .forEach(ink => runLabelsTests(ink));
18 |
19 | config.inks
20 | .filter(ink => ['one', 'equation3, 3times2'].includes(ink.name))
21 | .forEach(ink => runUndoTests(ink));
22 |
--------------------------------------------------------------------------------
/src/recognizer/common/CdkCommonUtil.js:
--------------------------------------------------------------------------------
1 | import { recognizerLogger as logger } from '../../configuration/LoggerConfig';
2 |
3 | /**
4 | * Extract the exports
5 | * @param {Model} model Current model
6 | * @return {Object} Recognition result
7 | */
8 | export function extractExports(model) {
9 | if (model.rawResults &&
10 | model.rawResults.exports &&
11 | model.rawResults.exports.result &&
12 | model.rawResults.exports.result.results &&
13 | model.rawResults.exports.result.results.length > 0) {
14 | return model.rawResults.exports.result.results
15 | .map((item) => {
16 | const res = {};
17 | if (Object.keys(item).includes('root')) {
18 | res[`${item.type}`] = item.root;
19 | } else {
20 | res[`${item.type}`] = item.value;
21 | }
22 | return res;
23 | })
24 | .reduce((a, b) => Object.assign(a, b), {});
25 | }
26 | return {};
27 | }
28 |
--------------------------------------------------------------------------------
/test/nightwatch/full/02-websocket/01-math-ws-full-cdkv3.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('MATH', 'WEBSOCKET', 'V3');
3 |
4 | function runLabelsTests(ink) {
5 | module.exports[config.header + ' checkLabels ' + ink.name] = function checkLabels(browser) {
6 | inkPlayer.checkLabels(browser, config, ink.strokes, ink.exports.LATEX, '#editor', '[data-key=LATEX]');
7 | };
8 | }
9 |
10 | function runUndoTests(ink) {
11 | module.exports[config.header + ' checkUndoRedo ' + ink.name] = function checkUndoRedo(browser) {
12 | inkPlayer.checkUndoRedo(browser, config, ink.strokes, ink.exports.LATEX, '#editor', '[data-key=LATEX]');
13 | };
14 | }
15 |
16 | config.inks
17 | .forEach(ink => runLabelsTests(ink));
18 |
19 | config.inks
20 | .filter(ink => ['one', 'equation3, 3times2'].includes(ink.name))
21 | .forEach(ink => runUndoTests(ink));
22 |
--------------------------------------------------------------------------------
/docs/script/inherited-summary.js:
--------------------------------------------------------------------------------
1 | (function(){
2 | function toggle(ev) {
3 | var button = ev.target;
4 | var parent = ev.target.parentElement;
5 | while(parent) {
6 | if (parent.tagName === 'TABLE' && parent.classList.contains('summary')) break;
7 | parent = parent.parentElement;
8 | }
9 |
10 | if (!parent) return;
11 |
12 | var tbody = parent.querySelector('tbody');
13 | if (button.classList.contains('opened')) {
14 | button.classList.remove('opened');
15 | button.classList.add('closed');
16 | tbody.style.display = 'none';
17 | } else {
18 | button.classList.remove('closed');
19 | button.classList.add('opened');
20 | tbody.style.display = 'block';
21 | }
22 | }
23 |
24 | var buttons = document.querySelectorAll('.inherited-summary thead .toggle');
25 | for (var i = 0; i < buttons.length; i++) {
26 | buttons[i].addEventListener('click', toggle);
27 | }
28 | })();
29 |
--------------------------------------------------------------------------------
/test/nightwatch/partial/01-rest-v3/01-math-rest-cdkv3.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('MATH', 'REST', 'V3');
3 |
4 | function runLabelTests(ink) {
5 | module.exports[config.header + ' checkLabels ' + ink.name] = function checkLabels(browser) {
6 | inkPlayer.checkLabels(browser, config, ink.strokes, ink.exports.LATEX, '#editor', '[data-key=LATEX]');
7 | };
8 | }
9 |
10 | function runUndoTests(ink) {
11 | module.exports[config.header + ' checkUndoRedo ' + ink.name] = function checkUndoRedo(browser) {
12 | inkPlayer.checkUndoRedo(browser, config, ink.strokes, ink.exports.LATEX, '#editor', '[data-key=LATEX]');
13 | };
14 | }
15 |
16 | config.inks
17 | .filter(ink => ['equation'].includes(ink.name))
18 | .forEach(ink => runLabelTests(ink));
19 |
20 | config.inks
21 | .filter(ink => ['one', 'equation3'].includes(ink.name))
22 | .forEach(ink => runUndoTests(ink));
23 |
--------------------------------------------------------------------------------
/test/nightwatch/full/00-env/00-websocket-test.js:
--------------------------------------------------------------------------------
1 | // const config = require('../../../lib/configuration').getConfiguration('TEXT', 'WEBSOCKET', 'V3');
2 | //
3 | // module.exports[config.header + ' long time duration test'] = function simple(browser) {
4 | // // let cont = true;
5 | // const start = new Date().getTime();
6 | // const strokes = config.inks[0].strokes;
7 | // const labels = config.inks[0].labels;
8 | //
9 | // console.log('start date = ' + start);
10 | // browser
11 | // .init(browser.launchUrl + config.componentPath)
12 | // .waitForElementVisible('#editor', 1000 * config.timeoutAmplificator)
13 | // .listenEditor()
14 | // .waitForElementPresent('#editorSupervisor', 1000 * config.timeoutAmplificator)
15 | // .waitUntilPlayInkThenClear(config, start, strokes, labels, 20000, null);
16 | // // .perform(checkLabelsThenClear)
17 | // // .getElapsedTime(start, stopCondition)
18 | // // .log(start);
19 | // browser.end();
20 | // };
21 |
--------------------------------------------------------------------------------
/test/nightwatch/partial/02-websocket-v3/01-math-ws-cdkv3.js:
--------------------------------------------------------------------------------
1 | const inkPlayer = require('../../lib/inkPlayer');
2 | const config = require('../../../lib/configuration').getConfiguration('MATH', 'WEBSOCKET', 'V3');
3 |
4 | function runLabelTests(ink) {
5 | module.exports[config.header + ' checkLabels ' + ink.name] = function checkLabels(browser) {
6 | inkPlayer.checkLabels(browser, config, ink.strokes, ink.exports.LATEX, '#editor', '[data-key=LATEX]');
7 | };
8 | }
9 |
10 | function runUndoTests(ink) {
11 | module.exports[config.header + ' checkUndoRedo ' + ink.name] = function checkUndoRedo(browser) {
12 | inkPlayer.checkUndoRedo(browser, config, ink.strokes, ink.exports.LATEX, '#editor', '[data-key=LATEX]');
13 | };
14 | }
15 |
16 | config.inks
17 | .filter(ink => ['equation'].includes(ink.name))
18 | .forEach(ink => runLabelTests(ink));
19 |
20 | config.inks
21 | .filter(ink => ['one', 'equation3'].includes(ink.name))
22 | .forEach(ink => runUndoTests(ink));
23 |
--------------------------------------------------------------------------------
/test/mocha/partial/ModelStats.spec.babel.js:
--------------------------------------------------------------------------------
1 | import { describe, it } from 'mocha';
2 | import { assert } from 'chai';
3 | import { testLogger as logger } from '../../../src/configuration/LoggerConfig';
4 | import * as InkModel from '../../../src/model/InkModel';
5 | import * as ModelStats from '../../../src/util/ModelStats';
6 |
7 | describe('Testing InkModel Stats', () => {
8 | it('Testing generated stats', () => {
9 | const initialModel = InkModel.createModel();
10 | const updatedModel1 = InkModel.initPendingStroke(initialModel, { x: 1, y: 1 });
11 | const updatedModel2 = InkModel.appendToPendingStroke(updatedModel1, { x: 2, y: 2 });
12 | const updatedModel3 = InkModel.appendToPendingStroke(updatedModel2, { x: 3, y: 3 });
13 | const updatedModel4 = InkModel.endPendingStroke(updatedModel3, { x: 4, y: 4 });
14 | logger.debug('Last model stats are ', ModelStats.computeStats(updatedModel4));
15 | assert.deepEqual(initialModel, updatedModel4);
16 | });
17 |
18 |
19 | // TODO Test all other function
20 | });
21 |
--------------------------------------------------------------------------------
/examples/assets/img/plus.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
42 |
--------------------------------------------------------------------------------
/src/recognizer/common/v3/Cdkv3CommonMathRecognizer.js:
--------------------------------------------------------------------------------
1 | import { recognizerLogger as logger } from '../../../configuration/LoggerConfig';
2 |
3 | /**
4 | * Extract the recognized symbols
5 | * @param {Model} model Current model
6 | * @return {Array