iink SDK Web

JIIX Missing In detail.exports

Hi,

I'm not able to get the JIIX from my editor. My export only provides the x-latex and mathML values. I'm using similar configs to https://github.com/MyScript/MyScriptJS/blob/master/examples/v4/import_math_jiix.html.


 useEffect(() => {
    let editor = editorRef.current;
    editor.addEventListener('exported'evt => {
        try{
            const exports = evt.detail.exports;
            console.log(exports)
            if (!exportsreturn;
            document.querySelector('.error-msg').style.display = "none"
            if (exports['application/x-latex']) {
              updater({type: ACTIONS.STAGING_LATEX,latex:exports['application/x-latex']});
            }
            if (exports['application/vnd.myscript.jiix']) {
              updater({type: ACTIONS.STAGING_INK,ink:JSON.stringify(exports)});
            }
          }
        catch{
          console.log({exports})
        }
      });
  
    editor = iink.register(editorRef.current, {
      recognitionParams: {
        type: 'MATH',
        protocol: 'WEBSOCKET',
        apiVersion: 'V4',
        server: {
            scheme: 'https',
            host: 'webdemoapi.myscript.com',
            applicationKey: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
            hmacKey: 'XXXXXXXXXXXXXXXXXXXXXXX'
        },
        v4: {
            math: {
                mimeTypes: ['application/x-latex''application/vnd.myscript.jiix'],
            },
            export: {
              jiix: {
                strokes: true,
              }
            }
        }
      }
    });
    
    window.addEventListener('resize', () => { 
      editor.resize() 
    });

    return () => {
      window.removeEventListener('resize', () => { editor.resize() });
      editor.close();
    }
  },[]);

Dear Winston,


thank you for contacting us and your question.


First, just a quick remark, regarding MyScriptJS, which is deprecated ; instead, you shall use the iinkJS (switching to the latter should not be a major issue) ; you can refer to the following samples.

-https://github.com/MyScript/iinkJS/tree/master/examples/v4

-https://github.com/MyScript/iinkjs/blob/master/examples/non-version-specific/on_demand_exports.html


To answer your question, the recognition result are sent asynchronously by the server: you can refer to the following topic, which explain how you shall proceed: https://developer-support.myscript.com/support/discussions/topics/16000029004


Let us know if you have further questions.


Best regards,


Olivier

My code is using iinkJS. The config in your example (https://github.com/MyScript/iinkJS/blob/master/examples/v4/import_math_jiix.html) is the same. I am using ReactJS with Hooks. Is that an issue? I'm getting an export. It just doesn't have the jiix data.

Dear Winston,


currently, I am not sure to understand the issue you are facing ; indeed, you are pointing to our "import" code sample, while you want to export in JIIX. Did you refer to our corresponding "export on-demand" code sample: https://myscript.github.io/MyScriptJS/examples/non-version-specific/on_demand_exports.html

Or you can give it a quick try: https://myscript.github.io/MyScriptJS/examples/non-version-specific/on_demand_exports.html


I am using ReactJS with Hooks. Is that an issue?

>>We do not have much experience of ReactJS, but at present we have not heard of such issue


It just doesn't have the jiix data.

>>Can you please try the export on-demand and let us know if this helps.


Best regards,


Olivier

Login or Signup to post a comment