feat: formulas can be inserted and edited, and survive both formats
A formula node stores only its LaTeX source; the MathML on screen, the ODF formula object and Word's OMML are derived from it, and both importers parse foreign markup back into that source, so an imported formula stays editable. Word documents were losing their formulas outright: m:oMath sits beside the w:r runs in its own namespace, past convertInline's `namespaceURI !== W` guard.
This commit is contained in:
1 parent
e9e543fe8c
commit
ee56a348ee
27 files changed
+1935
-4
No files matched your search
@@ -227,6 +227,32 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Formulas (formula.ts). MathML needs a font with an OpenType MATH table or Chromium
|
||||
drops ∑/ϕ and won't stretch brackets — STIX Two Math is bundled for that. */
|
||||
/* The family must be set on <math> itself: the UA stylesheet declares
|
||||
`math { font-family: math }` on the element, and an inherited value never beats it. */
|
||||
.paper .tiptap .formula math {
|
||||
font-family: 'STIX Two Math', math, serif;
|
||||
font-style: normal;
|
||||
}
|
||||
/* Baseline, not middle: an inline formula sits on the text baseline in LibreOffice and
|
||||
Word, and MathML already carries the right baseline for its own box. */
|
||||
.paper .tiptap span.formula {
|
||||
display: inline-block;
|
||||
vertical-align: baseline;
|
||||
cursor: pointer;
|
||||
}
|
||||
/* A display formula owns its line, centered, as in LibreOffice and Word. */
|
||||
.paper .tiptap span.formula[data-display='true'] {
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
.paper .tiptap span.formula.selected {
|
||||
outline: 2px solid var(--color-primary, #52748b);
|
||||
outline-offset: 1px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
/* Inline, as-character images (image.ts). The wrapper reserves the rotated bounding
|
||||
box; the rotor holds the <img>, resize handles and rotate grip, rotating together. */
|
||||
.paper .tiptap .image-node {
|
||||
|
||||
@@ -52,6 +52,18 @@
|
||||
src: url('../assets/fonts/EdenSymbols.woff2') format('woff2');
|
||||
}
|
||||
|
||||
/* STIX Two Math — a font with an OpenType MATH table is what makes MathML typeset:
|
||||
without one Chromium drops ∑ and ϕ entirely and leaves brackets glyph-height next
|
||||
to a fraction. Word uses Cambria Math for the same job. (OFL — see
|
||||
src/assets/fonts/LICENSE-STIX.txt.) */
|
||||
@font-face {
|
||||
font-family: 'STIX Two Math';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local('STIX Two Math'), url('../assets/fonts/STIXTwoMath-Regular.woff2') format('woff2');
|
||||
}
|
||||
|
||||
/* Metric-compatible substitutes for the common MS-Office fonts that imported
|
||||
.odt files reference. Each face is keyed to the MS name but prefers a real
|
||||
local copy, then a system twin, then the bundled open-source twin — so text
|
||||
|
||||
Reference in new issue
Block a user