arnog / mathlive

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

[FEATURE] Chemical equation editor #1493

Open Tanzz1058 opened 2 years ago

Tanzz1058 commented 2 years ago

Description

[Describe the bug or feature]

Any chemistry related content like isotopes, equations, molecular formula etc. is not editable in the math editor.

Steps to Reproduce

  1. Navigate to https://cortexjs.io/mathlive/demo/
  2. Type in any chemical formula or equation using the latex editor
  3. Try editing the contents using the math editor

Actual Behavior

The cursor does not move to expected locations to edit the content

Expected Behavior

The contents should be editable and cursor should move to let the user edit the equations/ formulae

Browser
Chrome

arnog commented 2 years ago

Editing or creating entire chemical formulas is currently not supported. This would be a great feature to contribute, though, if there is enough interest. It would require a new editing mode, different from the existing text and math modes, with specific keyboard shortcuts, a custom virtual keyboard, and a custom serializer.

LatoAndroid commented 10 months ago

@arnog Can you provide any insights into this modification? We also aim to implement the functionality for chemical equations, and things like the keyboard are not crucial; the editor is the most essential part. However, we haven't yet figured out a specific approach for the modification. Thank you!

arnog commented 10 months ago

This would probably involve creating a subclass of the Mode abstract class, along with a set of subclasses of the Atom abstract class representing the different kind of atoms (in the context of MathLive, not in the context of chemistry) that can be included in a chemical equation.