|
| 1 | +<!doctype html> |
| 2 | +<html lang="en-GB"> |
| 3 | +<head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <style> |
| 6 | + body { |
| 7 | + background: #fafafa; |
| 8 | + } |
| 9 | + iink-element { |
| 10 | + border: solid grey 2px; |
| 11 | + } |
| 12 | + #recoResults { |
| 13 | + width: 99%; |
| 14 | + height: 150px; |
| 15 | + } |
| 16 | + </style> |
| 17 | +</head> |
| 18 | +<body> |
| 19 | + <div id="demo"> |
| 20 | + <!-- This is a simple example, for configuration adjustment, |
| 21 | + you should create properties to wrap configuration or define it directly on component |
| 22 | + |
| 23 | + Here we support `params`to inject configuration : |
| 24 | + ex for MATH : params='{"iink":{"math":{"mimeTypes":["application/x-latex","application/vnd.myscript.jiix"]},"export":{"jiix":{"strokes":true}}}}' |
| 25 | + --> |
| 26 | + <iink-element |
| 27 | + type="TEXT" |
| 28 | + applicationKey="YOUR_APP_KEY" |
| 29 | + hmacKey="YOUR_HMAC_KEY" |
| 30 | + > |
| 31 | + </iink-element> |
| 32 | + Recognition results as JIIX read from the component event |
| 33 | + <textarea id="recoResults"></textarea> |
| 34 | + </div> |
| 35 | + |
| 36 | + <script type="module"> |
| 37 | + import '../iink-element.js'; |
| 38 | + |
| 39 | + window.addEventListener('load', () => { |
| 40 | + const iinkElement = document.querySelector('iink-element') |
| 41 | + const recoResults = document.querySelector('#recoResults') |
| 42 | + iinkElement.addEventListener('exported', (evt) => { |
| 43 | + if (evt.detail.exports && evt.detail.exports['application/vnd.myscript.jiix']) { |
| 44 | + recoResults.innerHTML = evt.detail.exports['application/vnd.myscript.jiix'] |
| 45 | + } |
| 46 | + }) |
| 47 | + }) |
| 48 | + </script> |
| 49 | +</body> |
| 50 | +</html> |
0 commit comments