Commit c5da3b4
authored
feat: add formula editor (#1484)
- Remove katex npm dependency, use existing window.MathJax instead
- Add renderWithMathJax() helper in FormulaEditorDialog for preview and snippet rendering
- Add escapeHtml to packages/core/src/utils/basicHelpers.ts
- Handle formula click in preview area to open formula editor (useCursorSync)
- Fix mobile scroll: formula library panel now scrollable on small screens
- EditorContextMenu/InsertDropdown: don't pass sourceRaw for selection-based editing, use replaceSelection() instead
- formula.ts: fix isWrapped detection to only check if unwrapFormula actually stripped delimiters
- editor.ts: replaceText() now replaces the occurrence nearest to the current cursor
- FormulaEditorDialog: cache MathJax snippet renders to avoid redundant re-renders
- katex.ts: remove unused data-math-latex attribute to reduce HTML output size
close #14831 parent d8bae22 commit c5da3b4
11 files changed
Lines changed: 581 additions & 3 deletions
File tree
- apps/web
- src
- components/editor
- editor-header
- composables
- stores
- utils
- views
- packages/core/src
- extensions
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
88 | 97 | | |
89 | 98 | | |
90 | 99 | | |
| |||
154 | 163 | | |
155 | 164 | | |
156 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
157 | 170 | | |
158 | 171 | | |
159 | 172 | | |
| |||
0 commit comments