feat(reply modal): add sci tex preview button (#1170)

* feat(sci): add 4chan-style TeX support with MathJax on /sci/

- [math]/[eqn] tags typeset with MathJax 3 (lazy chunk, only on /sci/ with math present)
- 4chan-identical config: Safe mode, left-aligned eqn, neutered \color/\newcommand macros
- TeX button in reply modal title bar opens live TeX Preview modal
- /sci/ post form rules bullets for [math]/[eqn] usage and right-click source
- MathJax context menu on right-click (Show Math As > TeX Commands)
- woff fonts served from node_modules in dev and emitted into build

* feat(sci): finish TeX support: configmacros fix, preview preload, translations, tests

- add configmacros package so the 4chan macro neutering (\color, \newcommand, ...) applies
- preload MathJax when the TeX Preview opens, like 4chan
- stable closeModal callback for the preview modal
- pre-bundle mathjax components in vite optimizeDeps to avoid dev mid-session reload
- translate the 6 new TeX keys into all 35 languages
- markdown math segment component tests + math-tags unit tests

* feat(reply modal): add sci tex preview button

* fix(tex-preview): clear MathJax bookkeeping and pending typeset on close

Addresses Cursor Bugbot: the preview output was typeset via typesetMathElement but
never passed to clearMathElement on unmount, so repeated open/close cycles kept
detached nodes in MathJax's math list. Also cancels the pending debounce timer.

* fix(reply-modal): reset TeX preview state when the reply modal closes

Addresses CodeRabbit: showTexPreview persisted across close/reopen like the
bbcode preview flags, so the TeX preview would auto-open on the next reply.
This commit is contained in:
Tommaso Casaburi
2026-06-11 16:12:38 +07:00
committed by GitHub
parent fa7cab0699
commit 17c63bb2e6
55 changed files with 1042 additions and 48 deletions
+7 -1
View File
@@ -407,5 +407,11 @@
"tor_author_flag_label": "ఈ వినియోగదారు Tor లో ఉన్నారు",
"copy_share_link": "భాగస్వామ్య లింక్‌ను కాపీ చేయండి",
"directory_submit_board": "మీ బోర్డును సమర్పించండి",
"all_subtitle": "ప్రతిదిరెక్టరీ నుండి అత్యధిక స్కోర్ చేసిన ఫోరం"
"all_subtitle": "ప్రతిదిరెక్టరీ నుండి అత్యధిక స్కోర్ చేసిన ఫోరం",
"tex_preview_protip": "ఇన్‌లైన్ సమీకరణాల కోసం [math][/math] ట్యాగ్‌లను ఉపయోగించండి, మరియు బ్లాక్ సమీకరణాల కోసం [eqn][/eqn] ట్యాగ్‌లను ఉపయోగించండి.",
"post_form_math_tags_prompt": "[math] ట్యాగ్‌లతో ఇన్‌లైన్ సమీకరణాల కోసం మరియు [eqn] ట్యాగ్‌లతో బ్లాక్ సమీకరణాల కోసం <tex>TeX</tex>ని ఉపయోగించండి.",
"post_form_math_right_click_prompt": "సమీకరణాలపై కుడి-క్లిక్ చేసి మూలాన్ని చూడండి.",
"tex_preview_title": "<tex>TeX</tex> ప్రీవ్యూ",
"tex_preview_input_label": "TeX మూలం",
"preview_tex_equations": "TeX సమీకరణల ప్రిన్ట్‌కు"
}