flw0 / equation-editor-react

Equation editor based on Mathquill for React web apps
https://flw0.github.io/equation-editor-react/
MIT License
62 stars 14 forks source link

How to send commands to mathquill #36

Open xnukernel opened 2 years ago

xnukernel commented 2 years ago

Is it possible to send commands to mathquill while still using your library?

I'd like to build out an interface with buttons that can insert certain latex symbols at the current selection. I believe mathquill allows this using executeCommand(-).

xnukernel commented 2 years ago

Okay I found out how to do this. If anyone is interested, add the following:

class EquationEditor {
    ...
    insert(input: string) {
        this.mathField.write(input)
    }
    ...
}
V0XNIHILI commented 2 years ago

If you want, feel free to add it as a PR!

xnukernel commented 2 years ago

Sorry it took me forever to get to this, here's the PR - https://github.com/flw0/equation-editor-react/pull/40