Improve MathEditor styles and toolbar - #2
Open
muditgoel135 wants to merge 5 commits into
Open
Conversation
Add contributor and clean up HTML/CSS; major enhancement of MathEditor defaults. - contributors.txt: add Mudit Goel. - index.html: fix indentation, remove unused second editor instance, simplify initialization and comment out template calls. - lib/matheditor.css: formatting/whitespace cleanup and several style tweaks (button sizing, toolbar/wrapper adjustments, keyboard layout spacing and positioning). - lib/matheditor.js: large refactor/extension of default configuration — reorganized variables, expanded default_toolbar_buttons and default_toolbar_tabs, and massively extended button_meta with many new symbols, operators, calculus/trig/set-theory/logic/matrix entries; preserved keyboard_keys but reformatted. This change greatly expands available toolbar items and reorganizes defaults; please review and test for any integration or API impacts.
Expand toolbar symbols (many trig, inverse, hyperbolic and power variants), add square symbol, and tweak several button latex values (e.g. sum/product, floor/ceil). Remove some legacy buttons (angle_brackets, logical_not_exists, some matrix presets) and simplify/math formatting for gcd/lcm/modulo and set theory symbols. Refactor and pretty-print keyboard_keys into a structured object, improve HTML string building readability, and harden keyboard action handling. Improve styling/layout: clean up matheditor.css, switch various width rules to -webkit-fill-available or auto, adjust floating toolbar positioning, and minor JS formatting/whitespace changes to improve maintainability.
Introduce multi-line, document-style editing to MathEditor.
Summary of changes:
- README: document multi-line usage and APIs (getLines, getLatex/setLatex behavior, getPrintableValue) and usage notes about Enter/navigation/merging.
- CSS: add .me-container and .me-line styles to render a single outer box with line elements and prevent mid-formula wrapping.
- JS: implement multi-line internals:
- MathEditor.LINE_SEP constant and new per-line management (this.lines, activeField).
- _createLine/_removeLine helpers to create/remove MathQuill fields for each line.
- Handlers for enter, upOutOf/downOutOf, moveOutOf, deleteOutOf to split/merge/move caret across lines.
- getLines() returns per-line latex; getValue()/getLatex() join/split using LINE_SEP; setLatex() accepts \\\\ joins or a \begin{array} block; getPrintableValue() renders multi-line array.
- Click-on-container focuses last line; backward-compatible answerMathField alias preserved.
- Toolbar/keyboard wiring updated to accept the editor instance and to act on editor.activeField (current line) rather than a single MathField; virtual keyboard logic updated accordingly.
These changes make the editor behave like a simple word-processor with multiple lines while keeping single-line behavior unchanged and preserving backward compatibility where possible.
Introduce lib/config.js containing toolbar (button_meta) and on-screen keyboard (keyboard_keys) definitions plus ME_DEFAULT_TOOLBAR_BUTTONS and ME_DEFAULT_TOOLBAR_TABS to make the editor configuration editable without touching matheditor.js. Update README.md with corrected wording, usage notes (load config.js before matheditor.js), a Methods section, and configuration-file documentation (including MathEditor.LINE_SEP). Update index.html to include config.js and change body overflow to scroll. Add a short header note to lib/matheditor.js documenting the script-loaded config requirement. Minor stylesheet tweaks in lib/mathquill.css.
Replace MathQuill with a customized build that patches delimiter reflow so brackets auto-size to content; update CSS and docs to support tall expressions and avoid spurious vertical scrollbars. Changes: add README warning and a "Tall expressions & auto-sizing brackets" section; add <!DOCTYPE html> and change body overflow to auto in index.html; update lib/matheditor.css to use overflow-x:auto and overflow-y:hidden with explanatory comments; adjust lib/mathquill.css overflow rules; and replace lib/mathquill.min.js with the patched build. Do not replace mathquill.min.js with a stock download or the auto-sizing behavior will be lost.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add contributor and clean up HTML/CSS; major enhancement of MathEditor defaults.