Math

Answered

Custom math grammar content

Hi! I am using iink.js for MATH in web. I have two different math exercises. First exercise must recognize for example only numbers and letters and second one must recognize numbers, letters and math symbols. So my question is how can i set these different math grammar content when i switching between these two exercises.
I tried this, but it seems to not working.
editor.configuration.recognitionParams.iink.math.customGrammarContent = getGrammarContent()


Best Answer

Hi Vadim!


Thank you for your question.

It is currentely not possible to dynamically update the grammar configuration.


For you use case, we recommand you using two editors , one per grammar.

Then, when switching exercices, your application should switch the active editor to use the one configured with the grammar corresponding to the exercice.


You can refer to the multiple input fields examples, that illustrates how to use two different editors in the same page.

You can test the example here and find the corresponding source code.


 In the example, we switch active editor when changing active input field. Please also note the example is a Text example, but can be customized for Math.


Best regards,


Gwenaëlle

1 Comment

Answer

Hi Vadim!


Thank you for your question.

It is currentely not possible to dynamically update the grammar configuration.


For you use case, we recommand you using two editors , one per grammar.

Then, when switching exercices, your application should switch the active editor to use the one configured with the grammar corresponding to the exercice.


You can refer to the multiple input fields examples, that illustrates how to use two different editors in the same page.

You can test the example here and find the corresponding source code.


 In the example, we switch active editor when changing active input field. Please also note the example is a Text example, but can be customized for Math.


Best regards,


Gwenaëlle