How to make ENTER work in mathlive and activate auto scroll in ydirection in the input area?

Viewed 97

I have implemented Mathlive like this:

componentDidMount() {
  document.body.append(this.container);
  this.editor = window.MathLive.makeMathField(this.editorRef.current, {
    onKeystroke: (e, keyCode) => {
      if (keyCode == "[Space]") {
        this.insertLatex("\\,");
      }
    }
  })
}
.input {
  padding: 5px;
  overflow: auto;
  height: 18rem;
  width: 100%;
  margin-right: 2rem;
  border: 1px solid #CCCCCC;
  /* border: 1px solid #000; */
}
<div className={styles.input} ref={this.editorRef}>
  {this.state.initialLatex || "#?"}
</div>

The issue is that even after implementing ENTER using the MULTILINE and MATRIX approach (which is also not stable), I am unable to maintain auto-scroll as long as I enter the input in any direction either x-axis or y-axis.

Any idea ideas for this implementation would be helpful

0 Answers
Related