Skip to content
This repository was archived by the owner on Jan 4, 2021. It is now read-only.

Commit 01ccf94

Browse files
author
Francois-Xavier Gentilhomme
committed
[DEV] Add a text import example
1 parent 0660399 commit 01ccf94

File tree

10 files changed

+243
-8
lines changed

10 files changed

+243
-8
lines changed

docs/components/myscript-common-element/.bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@
4545
"paper-toggle-button": "^2.0.0",
4646
"paper-slider": "^2.0.2"
4747
},
48-
"_release": "3d6204dc59",
48+
"_release": "19c80fb8c3",
4949
"_resolution": {
5050
"type": "branch",
5151
"branch": "2.0.0-alpha1",
52-
"commit": "3d6204dc59f18cd6a8702175148f3ac10ab948aa"
52+
"commit": "19c80fb8c3e2e7c2cc2605d0de96639c1997f4b4"
5353
},
5454
"_source": "https://github.com/MyScript/myscript-common-element.git",
5555
"_target": "2.0.0-alpha1",

docs/components/myscript-common-element/examples/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ <h2>V4 - iink SDK web</h2>
3131
<li>
3232
<a href="v4/programmatic_init.html">Settings the attributes programmaticly</a>
3333
</li>
34+
<li>
35+
<a href="v4/latex_import.html">Configuring latex import</a>
36+
</li>
3437
</ul>
3538
<h2>V3 - CDK v3.2</h2>
3639
<ul>
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<!doctype html>
2+
<html>
3+
4+
<head>
5+
<!-- Those three meta make the capture of handwriting inputs easier on modile devices -->
6+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=no">
7+
<meta name="apple-mobile-web-app-capable" content="yes">
8+
<meta name="mobile-web-app-capable" content="yes">
9+
10+
<title>Import LaTeX</title>
11+
12+
<link rel="stylesheet" href="../examples.css">
13+
<style>
14+
nav {
15+
height: 60px;
16+
display: flex;
17+
justify-content: space-between;
18+
}
19+
20+
nav span {
21+
display: flex;
22+
}
23+
24+
.hidden {
25+
display: none;
26+
}
27+
28+
myscript-common-element {
29+
height: calc(100% - 60px);
30+
}
31+
</style>
32+
33+
<!-- As web components are not fully support -->
34+
<script src="../../../webcomponentsjs/webcomponents-loader.js"></script>
35+
<!-- myscript-common-element is import to be used later -->
36+
<link rel="import" href="../../myscript-common-element.html">
37+
<!-- we use a paper toast for the purpose of this demo -->
38+
<link rel="import" href="../../../paper-toast/paper-toast.html">
39+
</head>
40+
41+
<body>
42+
<nav>
43+
<span>
44+
<input type="text" id="latex" value="\sqrt {\dfrac {2} {3}}">
45+
</span>
46+
</nav>
47+
<paper-toast class="fit-top"></paper-toast>
48+
<!-- Please change applicationkey and hmackey below with those send by mail during your registration. You can re-access them by connecting to your dashboard at developer.myscript.com with your myscript account -->
49+
<myscript-common-element apiversion="V4"
50+
type="MATH"
51+
protocol="WEBSOCKET"
52+
scheme="https"
53+
host="newcloud.myscript.com"
54+
applicationkey="515131ab-35fa-411c-bb4d-3917e00faf60"
55+
hmackey="54b2ca8a-6752-469d-87dd-553bb450e9ad"
56+
debug>
57+
</myscript-common-element>
58+
<script>
59+
const paperToast = document.querySelector('paper-toast');
60+
const component = document.querySelector('myscript-common-element');
61+
const latexInput = document.querySelector('#latex');
62+
63+
component.addEventListener('exported', (event) => {
64+
paperToast.text = `Recognition object contains : ${JSON.stringify(event.detail)}`;
65+
paperToast.fitIn = paperToast.show();
66+
});
67+
68+
latexInput.addEventListener('change', function(e) {
69+
component.importContent({x: 0, y: 0}, new Blob([e.target.value], {type : 'application/x-latex'}));
70+
});
71+
72+
component.importContent({x: 0, y: 0}, new Blob([latexInput.value], {type : 'application/x-latex'}));
73+
</script>
74+
</body>
75+
76+
</html>

docs/components/myscript-text-web/examples/index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ <h2>V4 - iink SDK web</h2>
2222
<li>
2323
<a href="v4/styling.html">Configure the style</a>
2424
</li>
25+
<li>
26+
<a href="v4/text_import.html">Configuring text import</a>
27+
</li>
2528
</ul>
2629
<h2>V3 - CDK v3.2</h2>
2730
<ul>
@@ -35,7 +38,7 @@ <h2>V3 - CDK v3.2</h2>
3538
<a href="v3/styling.html">Configure the style</a>
3639
</li>
3740
<li>
38-
<a href="v3/styling.html">Using superimposed - letters write on top of the others</a>
41+
<a href="v3/superimposed.html">Using superimposed - letters write on top of the others</a>
3942
</li>
4043
</ul>
4144
<h2>Non version specific features</h2>
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<!doctype html>
2+
<html>
3+
4+
<head>
5+
<!-- Those three meta make the capture of handwriting inputs easier on modile devices -->
6+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=no">
7+
<meta name="apple-mobile-web-app-capable" content="yes">
8+
<meta name="mobile-web-app-capable" content="yes">
9+
10+
<title>Import text</title>
11+
12+
<link rel="stylesheet" href="../examples.css">
13+
<style>
14+
nav {
15+
height: 60px;
16+
display: flex;
17+
justify-content: space-between;
18+
}
19+
20+
nav span {
21+
display: flex;
22+
}
23+
24+
.hidden {
25+
display: none;
26+
}
27+
28+
myscript-text-web {
29+
height: calc(100% - 60px);
30+
}
31+
</style>
32+
33+
<!-- As web components are not fully support -->
34+
<script src="../../../webcomponentsjs/webcomponents-loader.js"></script>
35+
<!-- myscript-common-element is import to be used later -->
36+
<link rel="import" href="../../myscript-text-web.html">
37+
<!-- we use a paper toast for the purpose of this demo -->
38+
<link rel="import" href="../../../paper-toast/paper-toast.html">
39+
</head>
40+
41+
<body>
42+
<nav>
43+
<span>
44+
<input type="text" id="text" value="hello world">
45+
</span>
46+
</nav>
47+
<paper-toast class="fit-top"></paper-toast>
48+
<!-- Please change applicationkey and hmackey below with those send by mail during your registration. You can re-access them by connecting to your dashboard at developer.myscript.com with your myscript account -->
49+
<myscript-text-web apiversion="V4"
50+
protocol="WEBSOCKET"
51+
scheme="https"
52+
host="newcloud.myscript.com"
53+
applicationkey="7d223f9e-a3cb-4213-ba4b-85e930605f8b"
54+
hmackey="5ab1935e-529a-4d48-a695-158450e52b13"
55+
debug>
56+
</myscript-text-web>
57+
<script>
58+
const paperToast = document.querySelector('paper-toast');
59+
const component = document.querySelector('myscript-text-web');
60+
const textInput = document.querySelector('#text');
61+
62+
component.addEventListener('exported', (event) => {
63+
paperToast.text = `Recognition object contains : ${JSON.stringify(event.detail)}`;
64+
paperToast.fitIn = paperToast.show();
65+
});
66+
67+
textInput.addEventListener('change', function (e) {
68+
component.importContent({ x: 0, y: 0 }, new Blob([e.target.value], { type: 'text/plain' }));
69+
});
70+
71+
component.importContent({ x: 0, y: 0 }, new Blob([textInput.value], { type: 'text/plain' }));
72+
</script>
73+
</body>
74+
75+
</html>

docs/components/myscript/.bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
"dependencies": {
2727
"pepjs": "^0.4.3"
2828
},
29-
"_release": "02dfd0e82e",
29+
"_release": "c1f71a66de",
3030
"_resolution": {
3131
"type": "branch",
3232
"branch": "2.0.0-alpha1",
33-
"commit": "02dfd0e82e1f3447246289684b17fc5c335bcb5f"
33+
"commit": "c1f71a66dea4a4a10fc19b6403eb45dce6701ad1"
3434
},
3535
"_source": "https://github.com/MyScript/MyScriptJS.git",
3636
"_target": "2.0.0-alpha1",

docs/components/myscript/dist/myscript.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/components/myscript/dist/myscript.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ <h2>V4 - iink SDK web</h2>
2222
<li>
2323
<a href="v4/styling.html">Configure the style</a>
2424
</li>
25+
<li>
26+
<a href="v4/text_import.html">Configuring text import</a>
27+
</li>
2528
</ul>
2629
<h2>V3 - CDK v3.2</h2>
2730
<ul>
@@ -35,7 +38,7 @@ <h2>V3 - CDK v3.2</h2>
3538
<a href="v3/styling.html">Configure the style</a>
3639
</li>
3740
<li>
38-
<a href="v3/styling.html">Using superimposed - letters write on top of the others</a>
41+
<a href="v3/superimposed.html">Using superimposed - letters write on top of the others</a>
3942
</li>
4043
</ul>
4144
<h2>Non version specific features</h2>

examples/v4/text_import.html

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<!doctype html>
2+
<html>
3+
4+
<head>
5+
<!-- Those three meta make the capture of handwriting inputs easier on modile devices -->
6+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=no">
7+
<meta name="apple-mobile-web-app-capable" content="yes">
8+
<meta name="mobile-web-app-capable" content="yes">
9+
10+
<title>Import text</title>
11+
12+
<link rel="stylesheet" href="../examples.css">
13+
<style>
14+
nav {
15+
height: 60px;
16+
display: flex;
17+
justify-content: space-between;
18+
}
19+
20+
nav span {
21+
display: flex;
22+
}
23+
24+
.hidden {
25+
display: none;
26+
}
27+
28+
myscript-text-web {
29+
height: calc(100% - 60px);
30+
}
31+
</style>
32+
33+
<!-- As web components are not fully support -->
34+
<script src="../../../webcomponentsjs/webcomponents-loader.js"></script>
35+
<!-- myscript-common-element is import to be used later -->
36+
<link rel="import" href="../../myscript-text-web.html">
37+
<!-- we use a paper toast for the purpose of this demo -->
38+
<link rel="import" href="../../../paper-toast/paper-toast.html">
39+
</head>
40+
41+
<body>
42+
<nav>
43+
<span>
44+
<input type="text" id="text" value="hello world">
45+
</span>
46+
</nav>
47+
<paper-toast class="fit-top"></paper-toast>
48+
<!-- Please change applicationkey and hmackey below with those send by mail during your registration. You can re-access them by connecting to your dashboard at developer.myscript.com with your myscript account -->
49+
<myscript-text-web apiversion="V4"
50+
protocol="WEBSOCKET"
51+
scheme="https"
52+
host="newcloud.myscript.com"
53+
applicationkey="7d223f9e-a3cb-4213-ba4b-85e930605f8b"
54+
hmackey="5ab1935e-529a-4d48-a695-158450e52b13"
55+
debug>
56+
</myscript-text-web>
57+
<script>
58+
const paperToast = document.querySelector('paper-toast');
59+
const component = document.querySelector('myscript-text-web');
60+
const textInput = document.querySelector('#text');
61+
62+
component.addEventListener('exported', (event) => {
63+
paperToast.text = `Recognition object contains : ${JSON.stringify(event.detail)}`;
64+
paperToast.fitIn = paperToast.show();
65+
});
66+
67+
textInput.addEventListener('change', function (e) {
68+
component.importContent({ x: 0, y: 0 }, new Blob([e.target.value], { type: 'text/plain' }));
69+
});
70+
71+
component.importContent({ x: 0, y: 0 }, new Blob([textInput.value], { type: 'text/plain' }));
72+
</script>
73+
</body>
74+
75+
</html>

0 commit comments

Comments
 (0)