math-rich-editor-pack 0.1.3 → 0.1.5
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 +20 -2
- package/dist-lib/math-rich-editor-pack.css +1 -1
- package/dist-lib/math-rich-editor.cjs +141 -141
- package/dist-lib/math-rich-editor.js +8429 -7931
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Reusable React editor for rich text and math equations in the same flow.
|
|
4
4
|
|
|
5
|
+
## Live Demo
|
|
6
|
+
|
|
7
|
+
https://math-rich-editor-pack-demo-s1ao.vercel.app/
|
|
8
|
+
|
|
5
9
|
## Install
|
|
6
10
|
|
|
7
11
|
```bash
|
|
@@ -46,6 +50,7 @@ export default function QuestionForm() {
|
|
|
46
50
|
- Advanced table actions are under `More`
|
|
47
51
|
- Load content from HTML
|
|
48
52
|
- Load content from DOCX (with equation conversion + warning reporting)
|
|
53
|
+
- Multiplication normalization for clearer display (`\cdot`, `·`, `⋅` -> `\times`)
|
|
49
54
|
|
|
50
55
|
## Callback API
|
|
51
56
|
|
|
@@ -64,6 +69,10 @@ export default function QuestionForm() {
|
|
|
64
69
|
- `result.success`: `boolean`
|
|
65
70
|
- `result.warnings`: `string[]`
|
|
66
71
|
- `result.error`: `string | null`
|
|
72
|
+
- `onDocxUnsupported(payload)`
|
|
73
|
+
- `payload.items`: unsupported DOCX object summary (`chart`, `smartArt`, `shape`, `vmlShape`)
|
|
74
|
+
- `payload.extractedMediaCount`: number
|
|
75
|
+
- `payload.extractedMediaNames`: string[]
|
|
67
76
|
|
|
68
77
|
## Ref Methods (Imperative API)
|
|
69
78
|
|
|
@@ -76,7 +85,7 @@ const editorRef = useRef(null)
|
|
|
76
85
|
Available methods:
|
|
77
86
|
|
|
78
87
|
- `loadFromHtml(html: string): boolean`
|
|
79
|
-
- `loadFromDocx(fileOrBuffer: File | Blob | ArrayBuffer): Promise<{ source, success, warnings, error }>`
|
|
88
|
+
- `loadFromDocx(fileOrBuffer: File | Blob | ArrayBuffer): Promise<{ source, success, warnings, error, html, unsupported }>`
|
|
80
89
|
- `getContent(): { html, json, text, latexList } | null`
|
|
81
90
|
|
|
82
91
|
Example:
|
|
@@ -93,6 +102,16 @@ if (file) {
|
|
|
93
102
|
const current = editorRef.current?.getContent()
|
|
94
103
|
```
|
|
95
104
|
|
|
105
|
+
## DOCX Support Notes
|
|
106
|
+
|
|
107
|
+
- Fully supported: regular text, formatting, lists, tables, OMML equations.
|
|
108
|
+
- Partially supported: charts, SmartArt, geometry/shapes.
|
|
109
|
+
- For unsupported objects:
|
|
110
|
+
- editor inserts readable fallback text markers (so users know content was present)
|
|
111
|
+
- warnings are returned in `onLoadResult`
|
|
112
|
+
- `onDocxUnsupported` returns structured unsupported details
|
|
113
|
+
- media from `word/media` is extracted and attached as fallback preview when unsupported objects are detected
|
|
114
|
+
|
|
96
115
|
## Props
|
|
97
116
|
|
|
98
117
|
- `initialContent`: HTML string or Tiptap JSON doc
|
|
@@ -124,4 +143,3 @@ npm run build
|
|
|
124
143
|
npm pack
|
|
125
144
|
npm publish --access public
|
|
126
145
|
```
|
|
127
|
-
|