Equation editor - #1515
Open
davrot wants to merge 6 commits into
Open
Equation editor#1515davrot wants to merge 6 commits into
davrot wants to merge 6 commits into
Conversation
…0765f Transplants the live equation-editor surface from the old CE+ checkout (commit 620765f) into the current CE upstream tree, restyled to the current Overleaf design system: - modules/latex-editor: toolbar button (sourceEditorToolbarEndButtons), equation editor modal (OLModal/OLButton/OLFormSelect), MathLive input with textarea fallback, 513-command search data, pure utils with unit tests (modules/latex-editor/test/unit) - math-preview tooltip: gated 'Open in Equation Editor' menu item (feature ol-latexEditorAvailable, was unconditional upstream) - mathlive 0.110.0 bundled locally (npm + CSS + KaTeX fonts copied to js/libs/mathlive-0.110.0/fonts; no CDN loads at runtime), version pin in PackageVersions with webpack sync check - i18n keys added to locales/en.json; CM access via useCodeMirrorViewContext instead of the old DOM hooks - dead code from the old commit NOT ported (symbol-palette.tsx, templates-sidebar.tsx, 15 category data files) - see references/latex-editor-transplant-plan.md
mathlive's package.json is not exposed by its exports map, so
require('mathlive/package.json') throws ERR_PACKAGE_PATH_NOT_EXPORTED
and breaks the webpack config load (caught by pre-build review).
Live feedback round: raw i18n keys, import failure, blocking modal,
stuck virtual keyboard, lost drag/minimize, trailing spaces on export.
- Root cause of raw keys: webpack translations-loader filters locale
JSON down to keys listed in frontend/extracted-translations.json;
regenerate with yarn extract-translations (all 27 module keys now
extracted) and add the 8 v5 strings to locales/en.json
- Restore the old commit's non-blocking floating window (draggable,
minimize/restore, no backdrop/focus-trap) so the MathLive virtual
keyboard on document.body stays usable; z-indexes from the old
stylesheet (.ML__keyboard above .latex-editor-modal-root)
- Import now handles both a non-empty selection and an
equation-under-cursor (mathAncestorNode/parseMathContainer, same
extraction the math preview tooltip uses); CM access stays on
CodeMirrorViewContext
- wrapLatex trims whitespace and leading/trailing MathLive
text-space tokens (\text{ }); unit tests added
- mathlive-input back on the proven init flow using debugConsole
MathLive CSS, nested font copy - 'Open in Equation Editor': the toolbar button listens on window (useEventListener hook) but the tooltip dispatched a non-bubbling document event that never arrived; dispatch now bubbles - mathlive/static.css (math-field + KaTeX font-faces) was missing from the v5 stylesheet rewrite; restore the @import - CopyPlugin nested the KaTeX fonts into fonts/fonts/ while MFE.fontsDirectory pointed at the outer dir (404 -> CDN fallback); copy to js/libs/mathlive-<version> so files land at <version>/fonts/
Implements the round-3 acceptance criterion: 'import an equation (or
open it via Open in Equation Editor) and press Export directly
afterwards - the equation with its environment is intact and the same'.
- splitEquation(): pure util that splits an equation as it appears in
the document into body + wrapper ($...$ -> inline, $$/\[ \] ->
display, \begin{equation*?} -> equation, \begin{eqnarray*?} ->
eqnarray); no fence -> new default wrapper 'inline'
- modal default export wrapper is now 'inline'; pre-loaded content and
imports are split into body (math-field) + detected environment
(select), so wrapLatex(body, wrapper) reproduces the original
- 'Open in Equation Editor' dispatches the equation's document range;
the button selects that range once open (visible mark), so Export
replaces the original equation exactly; clicking elsewhere moves the
selection and Export then inserts at the new cursor (no stale ranges)
- tooltip canonicalises display math to \[...\] (the display wrapper
form) before dispatch
- 10 new unit tests incl. round-trip canonical-form checks
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.
Description
Related issues / Pull Requests
Contributor Agreement
This is human guided AI (mainly qwen3.8; a bit of VS code copilot AI code might be left) and hence can not be copyrighted. You can do with the code what what ever you want.