arnog / mathlive

A web component for easy math input
https://cortexjs.io/mathlive
MIT License
1.58k stars 275 forks source link

Special keys in virtual keyboard aren't work #259

Closed Paosder closed 5 years ago

Paosder commented 5 years ago

Describe the bug When push the special key buttons in virtual keyboard, it won't work with no response.

To Reproduce

  1. Show any virtual keyboard.
  2. Click on '<' or '>' or any other special key buttons.

Expected behavior Move caret position left or right appropriately.

0.32, 0.29 also broken with same issue.

Screenshots error

Source Code

import React, {useRef, useEffect} from 'react';
import logo from './logo.svg';
import MathLive from 'mathlive';
import 'mathlive/dist/mathlive.core.css';
import 'mathlive/dist/mathlive.css';
import './App.css';

function App() {

  const targetRef = useRef();
  useEffect(() => {
    if (targetRef) {
      const mathField = MathLive.makeMathField(targetRef.current);
      mathField.$setConfig({
        virtualKeyboardMode: 'onfocus',
        virtualKeyboards: 'all'
      })
    }
  }, [targetRef]);
  return (
    <div className="App">
      <header className="App-header">
        <div ref={targetRef}>
          y=x
        </div>
      </header>
    </div>
  );
}

export default App;

Environment

Paosder commented 5 years ago

Okay, I found that current mathlive in npm repo had these problems, however it is resolved in latest master branch. I hope it will be fixed soon!

arnog commented 5 years ago

I have pushed an update (0.32.2) that should address this issue.