@ihsanabuhanifah/react-math-editor 1.1.0 → 1.1.1
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 +39 -6
- package/dist/index.cjs +75 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5775 -5724
- package/dist/index.js.map +1 -1
- package/package.json +12 -1
package/README.md
CHANGED
|
@@ -105,7 +105,20 @@ export function QuestionCard({ htmlContent }: { htmlContent: string }) {
|
|
|
105
105
|
|
|
106
106
|
## ⚙️ API & Props Reference
|
|
107
107
|
|
|
108
|
-
### `<
|
|
108
|
+
### `<SmartContentEditor />` *(Featured Full-Featured Component)*
|
|
109
|
+
|
|
110
|
+
| Prop | Type | Default | Description |
|
|
111
|
+
| :--- | :--- | :--- | :--- |
|
|
112
|
+
| `value` | `string` | `""` | Initial or controlled HTML content |
|
|
113
|
+
| `handleChange` / `onChange` | `(html: string) => void` | `undefined` | Callback fired on content change |
|
|
114
|
+
| `readOnly` | `boolean` | `false` | Read-only mode (ideal for question previews & test cards) |
|
|
115
|
+
| `minHeight` | `number` | `140` | Minimum height for editing area in pixels |
|
|
116
|
+
| `placeholder` | `string` | `"Tulis konten..."` | Placeholder text when empty |
|
|
117
|
+
| `onUploadImage` | `(file: File) => Promise<string>` | `undefined` | Async upload for image insertions, drag-drop, or screenshot paste |
|
|
118
|
+
| `onUploadFile` | `(file: File) => Promise<{ url, name, size }>` | `undefined` | Async upload for document attachment nodes |
|
|
119
|
+
| `className` | `string` | `""` | Optional CSS class name |
|
|
120
|
+
|
|
121
|
+
### `<TextEditor />` *(Standard Rich Math Editor)*
|
|
109
122
|
|
|
110
123
|
| Prop | Type | Default | Description |
|
|
111
124
|
| :--- | :--- | :--- | :--- |
|
|
@@ -120,7 +133,7 @@ export function QuestionCard({ htmlContent }: { htmlContent: string }) {
|
|
|
120
133
|
| `toolbarExtra` | `React.ReactNode` | `undefined` | Slot for custom action buttons in the toolbar |
|
|
121
134
|
| `className` | `string` | `""` | Additional CSS class names for outer container |
|
|
122
135
|
|
|
123
|
-
### `<RenderMathHTML />`
|
|
136
|
+
### `<RenderMathHTML />` *(Lightweight Output Viewer)*
|
|
124
137
|
|
|
125
138
|
| Prop | Type | Default | Description |
|
|
126
139
|
| :--- | :--- | :--- | :--- |
|
|
@@ -133,16 +146,36 @@ export function QuestionCard({ htmlContent }: { htmlContent: string }) {
|
|
|
133
146
|
|
|
134
147
|
## 💡 Framework Support
|
|
135
148
|
|
|
136
|
-
### Next.js (App Router
|
|
137
|
-
|
|
149
|
+
### Next.js (App Router & Pages Router)
|
|
150
|
+
The library is pre-configured with `'use client';` and SSR hydration guards (`immediatelyRender: false`), making it fully compatible with Next.js:
|
|
138
151
|
|
|
139
152
|
```tsx
|
|
140
153
|
'use client';
|
|
141
|
-
|
|
154
|
+
|
|
155
|
+
import { SmartContentEditor, RenderMathHTML } from "@ihsanabuhanifah/react-math-editor";
|
|
142
156
|
import "@ihsanabuhanifah/react-math-editor/dist/style.css";
|
|
157
|
+
|
|
158
|
+
export default function SoalPage() {
|
|
159
|
+
const [content, setContent] = useState("");
|
|
160
|
+
|
|
161
|
+
return <SmartContentEditor value={content} handleChange={setContent} />;
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Or with `next/dynamic` if you prefer client-only lazy loading:
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
import dynamic from "next/dynamic";
|
|
169
|
+
import "@ihsanabuhanifah/react-math-editor/dist/style.css";
|
|
170
|
+
|
|
171
|
+
const SmartContentEditor = dynamic(
|
|
172
|
+
() => import("@ihsanabuhanifah/react-math-editor").then((mod) => mod.SmartContentEditor),
|
|
173
|
+
{ ssr: false }
|
|
174
|
+
);
|
|
143
175
|
```
|
|
144
176
|
|
|
145
|
-
### Vite / Create React App
|
|
177
|
+
### Vite / Remix / Create React App
|
|
178
|
+
Works directly out of the box with zero extra configuration. Just import the component and the stylesheet.
|
|
146
179
|
Works directly out of the box. Simply import the component and the stylesheet.
|
|
147
180
|
|
|
148
181
|
---
|