Open DanielJGeiger opened 8 months ago
Currently, as you can see, the AsciiMath input jax has not been ported to a native v3 input jax, but instead loads the legacy v2 code and patches it in through some hacked shim code. The AsciiMath code needs to be ported to an actual v3 input jax so that the legacy v2 code can be dropped. This is one of the last remaining v2 pieces that needs to be moved to v3.
We are not planning to make changes to the legacy v2 code at this time, but appreciate the effort you have put into providing the changes you have made. I'm sure that will be useful to others who are having similar issues to yours.
Issue Summary
Vite uses strict mode, so the usage of
arguments.callee
fails. Besides removingarguments.callee
from the relevant JS files, Vite compatibility evidently requires slight changes to an additional AsciiMath JS file.Steps to Reproduce:
See https://excalidraw-mcjzus0ve-excalidraw.vercel.app/ (source commit https://github.com/excalidraw/excalidraw/pull/6037/commits/27a8cda8fdf7e7bc4e0d44f27bfa11cee21fc1cd) for an example of https://github.com/mathjax/MathJax-src/pull/854 in use. In this deployment:
\(\alpha\)
and press "Escape".Technical Details:
I am configuring and loading MathJax via
loadMathJax()
in src/element/subtypes/mathjax/implementation.tsx.Supporting Information:
arguments.callee
failing: https://excalidraw-k7bnvq58q-excalidraw.vercel.app/ (source commit https://github.com/excalidraw/excalidraw/pull/6037/commits/dd5053149a20acfa2817b5ef943897d4d08ea3a4).arguments.callee
: "Uncaught (in promise) TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them".js/input/asciimath/mathjax2/input/AsciiMath.js
in https://github.com/excalidraw/excalidraw/pull/6037/commits/27a8cda8fdf7e7bc4e0d44f27bfa11cee21fc1cd results in the browser console error "Uncaught (in promise) ReferenceError: global is not defined".patch-package
in production on https://math.preview.excalidraw.com/ without issue. See excalidraw/excalidraw#7063 for the patch as I would submit it against the MathJax-srcdevelop
branch.