concludio / react-mathlive

A react wrapper-component for mathlive.js
MIT License
25 stars 16 forks source link

how to listen keyDown event? #19

Closed linlinNB closed 3 years ago

linlinNB commented 3 years ago

how to setting Fontsize?

Khazuar commented 3 years ago

You can use the mathfieldConfig-property to provide configuration for the underlying mathfield, like this:

<MathfieldComponent 
  initialLatex="f(x)"
  mathfieldConfig={{
    onKeystroke: (mathfield, keystroke, event) => { /* whatever */ },
    style: {
      fontSize: 15,
    },
  }}
/>

You can see a complete documentation of all the configuration options here

Hope that helps.

linlinNB commented 3 years ago

Thank you for your answer. I find problem that ’style‘ attribute doesn't work.

Khazuar commented 3 years ago

That would be an issue with mathlive then

arnog commented 3 years ago

The style attribute is not a valid MathLive option (but maybe it's a mathlive-react attribute?). With MathLive, the way you would control the size of the mathfield is by styling the element containing the mathfield (i.e. setting the CSS font-size attribute of that element). I think this should also work with mathlive-react, though.