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

Commit 8681537

Browse files
committed
[DEV] Add custom resources example
1 parent 4af6200 commit 8681537

File tree

13 files changed

+589
-293
lines changed

13 files changed

+589
-293
lines changed

analysis.json

Lines changed: 213 additions & 141 deletions
Large diffs are not rendered by default.

docs/components/myscript-text-web/analysis.json

Lines changed: 213 additions & 141 deletions
Large diffs are not rendered by default.

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,20 @@ <h2>Non version specific features</h2>
195195
</div>
196196
<div class="grid-column-two">
197197
<h2>V4 - iink SDK web</h2>
198+
<p><strong>Custom resources</strong></p>
199+
<div class="center">
200+
<a href="v4/custom_resources.html" class="btn">
201+
<svg class="icn">
202+
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icn-play"></use>
203+
</svg>
204+
View example</a>
205+
<a href="https://github.com/MyScript/myscript-text-web/blob/master/examples/v4/custom_resources.html"
206+
target="_blank" class="btn">
207+
<svg class="icn">
208+
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icn-github"></use>
209+
</svg>
210+
Get source code</a>
211+
</div>
198212
<p><strong>Change fonts</strong></p>
199213
<div class="center">
200214
<a href="v4/change_fonts.html" class="btn">

docs/components/myscript-text-web/examples/v4/change_fonts.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
</div>
5454
</nav>
5555
<myscript-text-web scheme="https"
56-
host="cloud-internal-stable.corp.myscript.com"
56+
host="webdemoapi.myscript.com"
5757
applicationkey="515131ab-35fa-411c-bb4d-3917e00faf60"
5858
hmackey="54b2ca8a-6752-469d-87dd-553bb450e9ad"
5959
touch-action="none">
@@ -77,7 +77,7 @@
7777

7878
function getFontsForLang(language) {
7979
fontsElement.options.length = 0;
80-
request('http://cloud-internal-stable.corp.myscript.com/api/v4.0/iink/font/google/language/' + language)
80+
request('http://webdemoapi.myscript.com/api/v4.0/iink/font/google/language/' + language)
8181
.then(function(e) {
8282
res = JSON.parse(e.target.responseText).result;
8383
Object.keys(res).forEach(function (index) {
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<!-- Those meta make the capture of handwriting inputs easier on mobile devices -->
6+
<meta charset="UTF-8">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
8+
<meta name="apple-mobile-web-app-capable" content="yes">
9+
<meta name="mobile-web-app-capable" content="yes">
10+
<meta name="HandheldFriendly" content="true"/>
11+
12+
<title>Get started</title>
13+
14+
<link rel="stylesheet" href="../examples.css">
15+
16+
<script src="../../../webcomponentsjs/webcomponents-loader.js"></script>
17+
<script src="../../../pepjs/dist/pep.min.js"></script>
18+
<link rel="import" href="../../myscript-text-web.html">
19+
<style>
20+
.description {
21+
margin: 12px;
22+
}
23+
</style>
24+
</head>
25+
26+
<body>
27+
<p class="description">Custom resources: <b>Dinosaurs</b>. Try to write some dinosaurs name!</p>
28+
<myscript-text-web scheme="https"
29+
host="webdemoapi.myscript.com"
30+
applicationkey="515131ab-35fa-411c-bb4d-3917e00faf60"
31+
hmackey="54b2ca8a-6752-469d-87dd-553bb450e9ad"
32+
touch-action="none"
33+
customresources='["dinosaur"]'
34+
addlktext="true">
35+
</myscript-text-web>
36+
</body>
37+
</html>

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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,22 @@
521521
reflectToAttribute: true,
522522
notify: true
523523
},
524+
/**
525+
* If set to true, lexical knowledge (LK) is added to current LK, false otherwise
526+
*/
527+
addlktext: {
528+
type: Boolean,
529+
value: false,
530+
reflectToAttribute: true
531+
},
532+
/**
533+
* Name of the custom resources to be used
534+
*/
535+
customresources: {
536+
type: Array,
537+
value: [],
538+
reflectToAttribute: true
539+
},
524540
/**
525541
* If set to true, hide the export panel.
526542
*/
@@ -752,7 +768,7 @@
752768
return stylesheet;
753769
}
754770

755-
static _generateTextConfiguration(configuration, language, mimetypes, disableguidelines, disablesmartguide, enablesmartguidefadeout, smartguidefadeoutduration, textinputmode, resultdetail, contenttypes, subsetknowledges, userlkwords, userresources, textcandidatelistsize, wordcandidatelistsize, wordpredictionlistsize, wordcompletionlistsize, charactercandidatelistsize, enableoutoflexicon, discardcasevariations, discardaccentuationvariations, glyphdistortion, enabletagger, spellingdistortion) {
771+
static _generateTextConfiguration(configuration, language, mimetypes, disableguidelines, disablesmartguide, enablesmartguidefadeout, smartguidefadeoutduration, addlktext, customresources, textinputmode, resultdetail, contenttypes, subsetknowledges, userlkwords, userresources, textcandidatelistsize, wordcandidatelistsize, wordpredictionlistsize, wordcompletionlistsize, charactercandidatelistsize, enableoutoflexicon, discardcasevariations, discardaccentuationvariations, glyphdistortion, enabletagger, spellingdistortion) {
756772
// FIXME: find a way to do a proper deep merge
757773
const conf = Object.assign({}, configuration);
758774
if (!conf.recognitionParams) {
@@ -798,6 +814,13 @@
798814
if (smartguidefadeoutduration) {
799815
conf.recognitionParams.v4.text.smartGuideFadeOut.duration = smartguidefadeoutduration;
800816
}
817+
if (!conf.recognitionParams.v4.text.configuration) {
818+
conf.recognitionParams.v4.text.configuration = {};
819+
}
820+
if (customresources) {
821+
conf.recognitionParams.v4.text.configuration.customResources = customresources;
822+
conf.recognitionParams.v4.text.configuration.addLKText = addlktext;
823+
}
801824
if (textinputmode) {
802825
conf.recognitionParams.v3.textParameter.textInputMode = textinputmode;
803826
}
@@ -866,6 +889,8 @@
866889
this.disablesmartguide,
867890
this.enablesmartguidefadeout,
868891
this.smartguidefadeoutduration,
892+
this.addlktext,
893+
this.customresources,
869894
this.textinputmode,
870895
this.resultdetail,
871896
this.contenttypes,

docs/components/myscript/.bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
"!bower.json",
2424
"!dist/**/*"
2525
],
26-
"_release": "ed5975381c",
26+
"_release": "3531514660",
2727
"_resolution": {
2828
"type": "branch",
2929
"branch": "master",
30-
"commit": "ed5975381c436956adeb4435941e43d0bc89090c"
30+
"commit": "35315146600ae90a8f833299860a5593eec6279c"
3131
},
3232
"_source": "https://github.com/MyScript/MyScriptJS.git",
3333
"_target": "master",

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

Lines changed: 2 additions & 2 deletions
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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,20 @@ <h2>Non version specific features</h2>
195195
</div>
196196
<div class="grid-column-two">
197197
<h2>V4 - iink SDK web</h2>
198+
<p><strong>Custom resources</strong></p>
199+
<div class="center">
200+
<a href="v4/custom_resources.html" class="btn">
201+
<svg class="icn">
202+
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icn-play"></use>
203+
</svg>
204+
View example</a>
205+
<a href="https://github.com/MyScript/myscript-text-web/blob/master/examples/v4/custom_resources.html"
206+
target="_blank" class="btn">
207+
<svg class="icn">
208+
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icn-github"></use>
209+
</svg>
210+
Get source code</a>
211+
</div>
198212
<p><strong>Change fonts</strong></p>
199213
<div class="center">
200214
<a href="v4/change_fonts.html" class="btn">

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy