@zzish/math-rich-input 0.1.57 → 0.1.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -0
- package/dist/index.js +489 -112
- package/dist/math-rich-input.css +1 -1
- package/dist/standalone.js +1 -1
- package/package.json +7 -2
- package/scripts/build-katex-stylesheet.js +40 -0
- package/src/AccentBar.jsx +21 -21
- package/src/EquationEditor.jsx +44 -3
- package/src/EquationEditorModal.jsx +88 -0
- package/src/MathRichInput.css +3 -0
- package/src/MathRichInput.jsx +269 -29
- package/src/Toolbar.jsx +29 -15
- package/src/katexHelper.js +20 -38
- package/src/katexStylesheet.generated.js +3 -0
- package/src/mathRichInputHelper.js +7 -3
- package/src/standalone.js +48 -5
package/README.md
CHANGED
|
@@ -36,6 +36,28 @@ export default class App extends Component {
|
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
### KaTeX stylesheet
|
|
40
|
+
|
|
41
|
+
The field draws formulas with KaTeX and puts KaTeX's stylesheet on the page itself, as `<style id="katex-css">`,
|
|
42
|
+
when the first field mounts (and, in the standalone build, when the element is defined). It is the stylesheet of
|
|
43
|
+
`katex@0.11.1`, the one the field has always used, carried inside the package with its woff2 fonts inlined:
|
|
44
|
+
nothing is fetched from a CDN, and nothing arrives late to resize a field that was already drawn.
|
|
45
|
+
|
|
46
|
+
Up to 0.1.58 the same stylesheet was appended from `cdn.jsdelivr.net`. Hosts keep exactly the look they had.
|
|
47
|
+
A host that wants its own KaTeX stylesheet instead puts it on the page under the id `katex-css` first; the field
|
|
48
|
+
then adds nothing.
|
|
49
|
+
|
|
50
|
+
`src/katexStylesheet.generated.js` is built from the pinned `katex-0.11.1` dev dependency by
|
|
51
|
+
`scripts/build-katex-stylesheet.js`, which `npm run build` and `npm test` run first.
|
|
52
|
+
|
|
53
|
+
### Custom element: drawn before the first paint
|
|
54
|
+
|
|
55
|
+
`<math-rich-input>` (the standalone build) draws its first render synchronously, before the browser
|
|
56
|
+
can paint, wherever it is connected from — inside a click, in a framework's microtask flush, or when
|
|
57
|
+
the bundle arrives and upgrades fields already on the page. Until 0.1.58 a field connected outside a
|
|
58
|
+
discrete event was drawn later, in React's scheduled slices: a host showed empty fields that filled
|
|
59
|
+
one at a time.
|
|
60
|
+
|
|
39
61
|
### Normal usage
|
|
40
62
|
|
|
41
63
|
```js
|