react-latex-editor-custom-mhzn-v2 1.0.0
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/LICENSE +20 -0
- package/README.md +342 -0
- package/dist/components/CharacterCount.d.ts +6 -0
- package/dist/components/CharacterCount.d.ts.map +1 -0
- package/dist/components/Editor.d.ts +83 -0
- package/dist/components/Editor.d.ts.map +1 -0
- package/dist/components/EditorToolbar.d.ts +10 -0
- package/dist/components/EditorToolbar.d.ts.map +1 -0
- package/dist/components/ErrorBoundary.d.ts +20 -0
- package/dist/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/components/ImagePickerDialog.d.ts +15 -0
- package/dist/components/ImagePickerDialog.d.ts.map +1 -0
- package/dist/components/LoadingOverlay.d.ts +5 -0
- package/dist/components/LoadingOverlay.d.ts.map +1 -0
- package/dist/components/MathEquationDialog.d.ts +39 -0
- package/dist/components/MathEquationDialog.d.ts.map +1 -0
- package/dist/components/ModalPortal.d.ts +11 -0
- package/dist/components/ModalPortal.d.ts.map +1 -0
- package/dist/components/ResizableImageView.d.ts +22 -0
- package/dist/components/ResizableImageView.d.ts.map +1 -0
- package/dist/components/ResizableYoutubeView.d.ts +18 -0
- package/dist/components/ResizableYoutubeView.d.ts.map +1 -0
- package/dist/components/TableControls.d.ts +8 -0
- package/dist/components/TableControls.d.ts.map +1 -0
- package/dist/components/Viewer.d.ts +38 -0
- package/dist/components/Viewer.d.ts.map +1 -0
- package/dist/components/toolbars/AlignmentControls.d.ts +8 -0
- package/dist/components/toolbars/AlignmentControls.d.ts.map +1 -0
- package/dist/components/toolbars/BlockControls.d.ts +8 -0
- package/dist/components/toolbars/BlockControls.d.ts.map +1 -0
- package/dist/components/toolbars/ColorControls.d.ts +8 -0
- package/dist/components/toolbars/ColorControls.d.ts.map +1 -0
- package/dist/components/toolbars/FontControls.d.ts +8 -0
- package/dist/components/toolbars/FontControls.d.ts.map +1 -0
- package/dist/components/toolbars/HeadingControls.d.ts +8 -0
- package/dist/components/toolbars/HeadingControls.d.ts.map +1 -0
- package/dist/components/toolbars/HistoryControls.d.ts +8 -0
- package/dist/components/toolbars/HistoryControls.d.ts.map +1 -0
- package/dist/components/toolbars/ImageAlignmentControls.d.ts +13 -0
- package/dist/components/toolbars/ImageAlignmentControls.d.ts.map +1 -0
- package/dist/components/toolbars/ImageGroupAlignmentControls.d.ts +13 -0
- package/dist/components/toolbars/ImageGroupAlignmentControls.d.ts.map +1 -0
- package/dist/components/toolbars/ListControls.d.ts +8 -0
- package/dist/components/toolbars/ListControls.d.ts.map +1 -0
- package/dist/components/toolbars/SpecialFeaturesControls.d.ts +10 -0
- package/dist/components/toolbars/SpecialFeaturesControls.d.ts.map +1 -0
- package/dist/components/toolbars/TextFormattingControls.d.ts +8 -0
- package/dist/components/toolbars/TextFormattingControls.d.ts.map +1 -0
- package/dist/components/toolbars/ToolbarButton.d.ts +12 -0
- package/dist/components/toolbars/ToolbarButton.d.ts.map +1 -0
- package/dist/components/toolbars/ToolbarDivider.d.ts +3 -0
- package/dist/components/toolbars/ToolbarDivider.d.ts.map +1 -0
- package/dist/components/toolbars/YouTubeControls.d.ts +13 -0
- package/dist/components/toolbars/YouTubeControls.d.ts.map +1 -0
- package/dist/constants/config.d.ts +144 -0
- package/dist/constants/config.d.ts.map +1 -0
- package/dist/constants/editorConstants.d.ts +12 -0
- package/dist/constants/editorConstants.d.ts.map +1 -0
- package/dist/extensions/BackgroundColor.d.ts +12 -0
- package/dist/extensions/BackgroundColor.d.ts.map +1 -0
- package/dist/extensions/CustomTextStyle.d.ts +16 -0
- package/dist/extensions/CustomTextStyle.d.ts.map +1 -0
- package/dist/extensions/ImageGroup.d.ts +4 -0
- package/dist/extensions/ImageGroup.d.ts.map +1 -0
- package/dist/extensions/InlineMath.d.ts +11 -0
- package/dist/extensions/InlineMath.d.ts.map +1 -0
- package/dist/extensions/MathNode.d.ts +4 -0
- package/dist/extensions/MathNode.d.ts.map +1 -0
- package/dist/extensions/MathNodeView.d.ts +28 -0
- package/dist/extensions/MathNodeView.d.ts.map +1 -0
- package/dist/extensions/ResizableImageExtension.d.ts +3 -0
- package/dist/extensions/ResizableImageExtension.d.ts.map +1 -0
- package/dist/extensions/ResizableYoutubeExtension.d.ts +3 -0
- package/dist/extensions/ResizableYoutubeExtension.d.ts.map +1 -0
- package/dist/hooks/useEditorForceUpdate.d.ts +7 -0
- package/dist/hooks/useEditorForceUpdate.d.ts.map +1 -0
- package/dist/hooks/useEditorKeyboard.d.ts +10 -0
- package/dist/hooks/useEditorKeyboard.d.ts.map +1 -0
- package/dist/hooks/useEditorState.d.ts +38 -0
- package/dist/hooks/useEditorState.d.ts.map +1 -0
- package/dist/hooks/useResponsive.d.ts +2 -0
- package/dist/hooks/useResponsive.d.ts.map +1 -0
- package/dist/index.cjs.js +131 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +23223 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.html +6 -0
- package/dist/react-latex-editor-custom-mhzn-v2.css +1 -0
- package/dist/styles.d.ts +1 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/types/editor.d.ts +87 -0
- package/dist/types/editor.d.ts.map +1 -0
- package/dist/types/mathlive.d.ts +25 -0
- package/dist/types/mathlive.d.ts.map +1 -0
- package/dist/utils/contentStats.d.ts +13 -0
- package/dist/utils/contentStats.d.ts.map +1 -0
- package/dist/utils/editorConfig.d.ts +23 -0
- package/dist/utils/editorConfig.d.ts.map +1 -0
- package/dist/utils/editorUtils.d.ts +23 -0
- package/dist/utils/editorUtils.d.ts.map +1 -0
- package/dist/utils/helpers.d.ts +58 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/media.d.ts +30 -0
- package/dist/utils/media.d.ts.map +1 -0
- package/dist/utils/svgDom.d.ts +19 -0
- package/dist/utils/svgDom.d.ts.map +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +124 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 React Rich Text with Math
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
# react-latex-editor-custom-mhzn-v2
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/react-latex-editor-custom-mhzn-v2)
|
|
4
|
+
[](https://www.npmjs.com/package/react-latex-editor-custom-mhzn-v2)
|
|
5
|
+
[](./LICENSE)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
|
|
8
|
+
A React WYSIWYG editor with first-class LaTeX math support. Built on [TipTap](https://tiptap.dev/) with [MathLive](https://cortexjs.io/mathlive/) for equation authoring and MathJax for read-only rendering.
|
|
9
|
+
|
|
10
|
+
**[npm](https://www.npmjs.com/package/react-latex-editor-custom-mhzn-v2)** · **[Issues](https://github.com/muhzinasrori/react-latex-editor-custom-mhzn-v2-from-bablu-mia/issues)** · **[Changelog](https://github.com/muhzinasrori/react-latex-editor-custom-mhzn-v2-from-bablu-mia/releases)**
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- **Rich text** — bold, italic, underline, strike, colors, fonts, headings, lists, links, code blocks, blockquotes
|
|
17
|
+
- **Mathematics** — inline and display equations via MathLive; persists as HTML for round-trip editing
|
|
18
|
+
- **Tables** — insert, resize, and edit with row/column controls
|
|
19
|
+
- **Images** — upload, URL, drag-and-drop, resize, and alignment
|
|
20
|
+
- **SVG** — paste SVG markup from the toolbar, or insert programmatically
|
|
21
|
+
- **YouTube** — embed and resize videos
|
|
22
|
+
- **Viewer** — read-only rendering with MathJax
|
|
23
|
+
- **TypeScript** — full type definitions included
|
|
24
|
+
- **Accessible toolbar** — keyboard shortcuts and ARIA labels
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install react-latex-editor-custom-mhzn-v2
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Peer dependencies:** React 18+ or 19+
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install react react-dom
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Import styles once in your app entry (or layout):
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import "react-latex-editor-custom-mhzn-v2/styles";
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import { useRef, useState } from "react";
|
|
52
|
+
import { Editor, Viewer, type EditorRef } from "react-latex-editor-custom-mhzn-v2";
|
|
53
|
+
import "react-latex-editor-custom-mhzn-v2/styles";
|
|
54
|
+
|
|
55
|
+
export default function App() {
|
|
56
|
+
const [content, setContent] = useState("<p></p>");
|
|
57
|
+
const editorRef = useRef<EditorRef>(null);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<>
|
|
61
|
+
<Editor
|
|
62
|
+
ref={editorRef}
|
|
63
|
+
initialContent={content}
|
|
64
|
+
onChange={setContent}
|
|
65
|
+
placeholder="Start writing…"
|
|
66
|
+
minHeight="320px"
|
|
67
|
+
/>
|
|
68
|
+
<Viewer content={content} />
|
|
69
|
+
</>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Next.js
|
|
77
|
+
|
|
78
|
+
This package uses browser APIs (DOM, MathLive). Load it on the client only.
|
|
79
|
+
|
|
80
|
+
**App Router** — mark the module as a client component:
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
"use client";
|
|
84
|
+
|
|
85
|
+
import { useState } from "react";
|
|
86
|
+
import { Editor } from "react-latex-editor-custom-mhzn-v2";
|
|
87
|
+
import "react-latex-editor-custom-mhzn-v2/styles";
|
|
88
|
+
|
|
89
|
+
export default function MyEditor() {
|
|
90
|
+
const [content, setContent] = useState("<p></p>");
|
|
91
|
+
return <Editor initialContent={content} onChange={setContent} />;
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Pages Router** — disable SSR for the editor:
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
import dynamic from "next/dynamic";
|
|
99
|
+
|
|
100
|
+
const Editor = dynamic(
|
|
101
|
+
() => import("react-latex-editor-custom-mhzn-v2").then((m) => m.Editor),
|
|
102
|
+
{ ssr: false },
|
|
103
|
+
);
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Usage
|
|
109
|
+
|
|
110
|
+
### Editor ref
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
const editorRef = useRef<EditorRef>(null);
|
|
114
|
+
|
|
115
|
+
editorRef.current?.getHTML();
|
|
116
|
+
editorRef.current?.getJSON();
|
|
117
|
+
editorRef.current?.getText();
|
|
118
|
+
editorRef.current?.setContent("<p>Hello</p>");
|
|
119
|
+
editorRef.current?.clearContent();
|
|
120
|
+
editorRef.current?.focus();
|
|
121
|
+
|
|
122
|
+
// Images
|
|
123
|
+
editorRef.current?.addImage("https://example.com/photo.png");
|
|
124
|
+
editorRef.current?.addImage({
|
|
125
|
+
src: "https://example.com/diagram.svg",
|
|
126
|
+
mediaType: "svg",
|
|
127
|
+
alt: "Diagram",
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// SVG markup (same path as the toolbar “Paste SVG code” button)
|
|
131
|
+
await editorRef.current?.addSvg(
|
|
132
|
+
`<svg xmlns="http://www.w3.org/2000/svg">…</svg>`,
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
// Files from your own <input type="file">
|
|
136
|
+
await editorRef.current?.addImagesFromFiles(fileList);
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Mathematics
|
|
140
|
+
|
|
141
|
+
Use the equation button in the toolbar (or `Ctrl`/`Cmd`+`M`). Equations can be inline or display mode. Content is stored in the document HTML so `getHTML()` / `setContent()` round-trip correctly.
|
|
142
|
+
|
|
143
|
+
### Images and SVG
|
|
144
|
+
|
|
145
|
+
| Action | Behavior |
|
|
146
|
+
| ---------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
147
|
+
| **Insert image** (toolbar) | Built-in picker (file / URL) unless you pass `onImageSelectionRequest` |
|
|
148
|
+
| **Paste SVG code** (toolbar) | Opens a dialog to paste `<svg>…</svg>` markup — no extra setup |
|
|
149
|
+
| Paste / drop | Image and SVG files, plus SVG markup, work in the editor surface |
|
|
150
|
+
| Custom upload UI | Provide `onImageSelectionRequest`, then call `addImage` / `addImagesFromFiles` / `addSvg` on the ref |
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
import { useRef } from "react";
|
|
154
|
+
import {
|
|
155
|
+
Editor,
|
|
156
|
+
IMAGE_ACCEPT,
|
|
157
|
+
type EditorRef,
|
|
158
|
+
} from "react-latex-editor-custom-mhzn-v2";
|
|
159
|
+
|
|
160
|
+
function EditorWithCustomUpload() {
|
|
161
|
+
const editorRef = useRef<EditorRef>(null);
|
|
162
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<>
|
|
166
|
+
<input
|
|
167
|
+
ref={inputRef}
|
|
168
|
+
type="file"
|
|
169
|
+
accept={IMAGE_ACCEPT}
|
|
170
|
+
multiple
|
|
171
|
+
hidden
|
|
172
|
+
onChange={async (e) => {
|
|
173
|
+
if (e.target.files?.length) {
|
|
174
|
+
await editorRef.current?.addImagesFromFiles(e.target.files);
|
|
175
|
+
}
|
|
176
|
+
e.target.value = "";
|
|
177
|
+
}}
|
|
178
|
+
/>
|
|
179
|
+
<Editor
|
|
180
|
+
ref={editorRef}
|
|
181
|
+
onImageSelectionRequest={() => inputRef.current?.click()}
|
|
182
|
+
/>
|
|
183
|
+
</>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Viewer
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
import { Viewer } from "react-latex-editor-custom-mhzn-v2";
|
|
192
|
+
|
|
193
|
+
<Viewer
|
|
194
|
+
content={html}
|
|
195
|
+
className="viewer-shell"
|
|
196
|
+
contentClassName="prose max-w-none"
|
|
197
|
+
enableMath
|
|
198
|
+
/>;
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
- `className` — wrapper element
|
|
202
|
+
- `contentClassName` — content root (prefer this for typography)
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## API
|
|
207
|
+
|
|
208
|
+
### `Editor` props
|
|
209
|
+
|
|
210
|
+
| Prop | Type | Default | Description |
|
|
211
|
+
| ------------------------- | ------------------------ | ------------------- | -------------------------------------- |
|
|
212
|
+
| `initialContent` | `string` | `"<p></p>"` | Initial HTML |
|
|
213
|
+
| `onChange` | `(html: string) => void` | — | Fires on every update |
|
|
214
|
+
| `placeholder` | `string` | `"Start typing..."` | Empty-state placeholder |
|
|
215
|
+
| `readOnly` | `boolean` | `false` | Disable editing |
|
|
216
|
+
| `autoFocus` | `boolean` | `false` | Focus on mount |
|
|
217
|
+
| `className` | `string` | `""` | Extra class on the editor |
|
|
218
|
+
| `minHeight` | `string` | `"300px"` | Minimum editor height |
|
|
219
|
+
| `maxHeight` | `string` | — | Max height (scrollable) |
|
|
220
|
+
| `showCharacterCount` | `boolean` | `true` | Footer character / word stats |
|
|
221
|
+
| `showTableControls` | `boolean` | `true` | Table editing chrome |
|
|
222
|
+
| `onImageSelectionRequest` | `() => void` | — | Custom image picker; omit for built-in |
|
|
223
|
+
| `onError` | `(error: Error) => void` | — | Error callback |
|
|
224
|
+
|
|
225
|
+
### `EditorRef` methods
|
|
226
|
+
|
|
227
|
+
| Method | Signature | Description |
|
|
228
|
+
| -------------------- | ----------------------------------------------------- | ------------------------------------ |
|
|
229
|
+
| `getHTML` | `() => string` | Serialized HTML |
|
|
230
|
+
| `getJSON` | `() => Record<string, unknown>` | TipTap JSON document |
|
|
231
|
+
| `getText` | `() => string` | Plain text |
|
|
232
|
+
| `setContent` | `(content: string) => void` | Replace document |
|
|
233
|
+
| `clearContent` | `() => void` | Empty the editor |
|
|
234
|
+
| `focus` / `blur` | `() => void` | Focus management |
|
|
235
|
+
| `isEmpty` | `() => boolean` | Whether the doc is empty |
|
|
236
|
+
| `getEditor` | `() => Editor \| null` | Underlying TipTap instance |
|
|
237
|
+
| `addImage` | `(input: ImageInsertInput) => void` | Insert image(s) or SVG figures |
|
|
238
|
+
| `addSvg` | `(source: string \| File, options?) => Promise<void>` | Insert SVG from markup, URL, or file |
|
|
239
|
+
| `addImagesFromFiles` | `(files: FileList \| File[]) => Promise<void>` | Insert from a file list (data URLs) |
|
|
240
|
+
|
|
241
|
+
### `Viewer` props
|
|
242
|
+
|
|
243
|
+
| Prop | Type | Default | Description |
|
|
244
|
+
| ------------------ | --------- | ------- | ----------------- |
|
|
245
|
+
| `content` | `string` | — | HTML to display |
|
|
246
|
+
| `className` | `string` | `""` | Wrapper class |
|
|
247
|
+
| `contentClassName` | `string` | `""` | Content class |
|
|
248
|
+
| `enableMath` | `boolean` | `true` | Enable MathJax |
|
|
249
|
+
| `mathJaxConfig` | `object` | `{}` | MathJax overrides |
|
|
250
|
+
|
|
251
|
+
### Notable exports
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
import {
|
|
255
|
+
Editor,
|
|
256
|
+
Viewer,
|
|
257
|
+
IMAGE_ACCEPT,
|
|
258
|
+
insertMath,
|
|
259
|
+
insertSvg,
|
|
260
|
+
addImagesFromFiles,
|
|
261
|
+
type EditorProps,
|
|
262
|
+
type EditorRef,
|
|
263
|
+
type ImageInsertItem,
|
|
264
|
+
type ImageInsertInput,
|
|
265
|
+
} from "react-latex-editor-custom-mhzn-v2";
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Examples
|
|
271
|
+
|
|
272
|
+
**Minimal**
|
|
273
|
+
|
|
274
|
+
```tsx
|
|
275
|
+
<Editor
|
|
276
|
+
onChange={setContent}
|
|
277
|
+
showCharacterCount={false}
|
|
278
|
+
showTableControls={false}
|
|
279
|
+
/>
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
**Fixed height**
|
|
283
|
+
|
|
284
|
+
```tsx
|
|
285
|
+
<Editor minHeight="400px" maxHeight="640px" onChange={setContent} />
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Math-heavy content**
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
<Editor
|
|
292
|
+
initialContent="<p>Quadratic formula: </p>"
|
|
293
|
+
placeholder="Write with equations…"
|
|
294
|
+
onChange={setContent}
|
|
295
|
+
/>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**Styled viewer**
|
|
299
|
+
|
|
300
|
+
```tsx
|
|
301
|
+
<Viewer
|
|
302
|
+
content={content}
|
|
303
|
+
className="rounded-lg bg-neutral-50 p-6"
|
|
304
|
+
contentClassName="text-lg leading-relaxed"
|
|
305
|
+
/>
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Troubleshooting
|
|
311
|
+
|
|
312
|
+
| Issue | Fix |
|
|
313
|
+
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
314
|
+
| Unstyled editor | Import `react-latex-editor-custom-mhzn-v2/styles` |
|
|
315
|
+
| Next.js `window is not defined` | Use `"use client"` or `dynamic(..., { ssr: false })` |
|
|
316
|
+
| Math missing in Viewer | Keep `enableMath` enabled (default); check that content includes math nodes from the Editor |
|
|
317
|
+
| Custom image button does nothing | Call `addImagesFromFiles` / `addImage` / `addSvg` inside your `onImageSelectionRequest` handler |
|
|
318
|
+
| SVG not inserting | Use the **Paste SVG code** toolbar button, or `addSvg` with full `<svg>…</svg>` markup |
|
|
319
|
+
| `getStyleProperty` / TipTap export errors | Caused by mixing TipTap v2 and v3 in the host app. Use `react-latex-editor-custom-mhzn-v2@2.0.1+` (TipTap is pinned and bundled). Delete `node_modules` + lockfile and reinstall, or align all `@tiptap/*` packages to the same major. |
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## Requirements
|
|
324
|
+
|
|
325
|
+
- Node.js 16+
|
|
326
|
+
- React 18 or 19
|
|
327
|
+
- Modern evergreen browsers
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## Contributing
|
|
332
|
+
|
|
333
|
+
1. Fork and create a feature branch
|
|
334
|
+
2. Install dependencies and run `npm run dev`
|
|
335
|
+
3. Keep changes focused; run `npm run type-check` before opening a PR
|
|
336
|
+
4. Open a pull request with a clear description
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## License
|
|
341
|
+
|
|
342
|
+
[MIT](./LICENSE) © [Bablu Mia](https://github.com/bablu22)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CharacterCount.d.ts","sourceRoot":"","sources":["../../src/components/CharacterCount.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAK5C,QAAA,MAAM,cAAc,GAAI,YAAY;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,mDAkC5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Editor as TiptapEditor } from '@tiptap/react';
|
|
2
|
+
import { ImageInsertInput } from '../types/editor';
|
|
3
|
+
export interface EditorRef {
|
|
4
|
+
/**
|
|
5
|
+
* Insert image(s) or SVG figure(s).
|
|
6
|
+
* Accepts URL strings or `{ src, mediaType: "svg" }` objects.
|
|
7
|
+
*/
|
|
8
|
+
addImage: (input: ImageInsertInput) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Insert an SVG from markup, URL, data URL, or File.
|
|
11
|
+
*/
|
|
12
|
+
addSvg: (source: string | File, options?: {
|
|
13
|
+
alt?: string;
|
|
14
|
+
width?: string;
|
|
15
|
+
}) => Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Insert images/SVGs from a FileList (e.g. from your own file input).
|
|
18
|
+
* Converts to data URLs so content persists when saved via getHTML().
|
|
19
|
+
*/
|
|
20
|
+
addImagesFromFiles: (files: FileList | File[]) => Promise<void>;
|
|
21
|
+
getHTML: () => string;
|
|
22
|
+
getJSON: () => Record<string, unknown>;
|
|
23
|
+
getText: () => string;
|
|
24
|
+
setContent: (content: string) => void;
|
|
25
|
+
clearContent: () => void;
|
|
26
|
+
focus: () => void;
|
|
27
|
+
blur: () => void;
|
|
28
|
+
isEmpty: () => boolean;
|
|
29
|
+
getEditor: () => TiptapEditor | null;
|
|
30
|
+
}
|
|
31
|
+
export interface EditorProps {
|
|
32
|
+
/**
|
|
33
|
+
* Initial content of the editor
|
|
34
|
+
*/
|
|
35
|
+
initialContent?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Callback function when content changes
|
|
38
|
+
*/
|
|
39
|
+
onChange?: (content: string) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Placeholder text for the editor
|
|
42
|
+
*/
|
|
43
|
+
placeholder?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the editor is read-only
|
|
46
|
+
*/
|
|
47
|
+
readOnly?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Whether to auto-focus the editor on mount
|
|
50
|
+
*/
|
|
51
|
+
autoFocus?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Additional CSS class name for styling
|
|
54
|
+
*/
|
|
55
|
+
className?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Callback for image selection requests.
|
|
58
|
+
* If omitted, a built-in image picker dialog is shown.
|
|
59
|
+
*/
|
|
60
|
+
onImageSelectionRequest?: () => void;
|
|
61
|
+
/**
|
|
62
|
+
* Minimum height of the editor
|
|
63
|
+
*/
|
|
64
|
+
minHeight?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Maximum height of the editor (for scrolling)
|
|
67
|
+
*/
|
|
68
|
+
maxHeight?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Whether to show the character count
|
|
71
|
+
*/
|
|
72
|
+
showCharacterCount?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Whether to show table controls
|
|
75
|
+
*/
|
|
76
|
+
showTableControls?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Callback when an error occurs
|
|
79
|
+
*/
|
|
80
|
+
onError?: (error: Error) => void;
|
|
81
|
+
}
|
|
82
|
+
export declare const Editor: import('react').ForwardRefExoticComponent<EditorProps & import('react').RefAttributes<EditorRef>>;
|
|
83
|
+
//# sourceMappingURL=Editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../src/components/Editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,MAAM,IAAI,YAAY,EAAE,MAAM,eAAe,CAAC;AAoBtF,OAAO,sBAAsB,CAAC;AAQ9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC5C;;OAEG;IACH,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7F;;;OAGG;IACH,kBAAkB,EAAE,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,OAAO,EAAE,MAAM,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,OAAO,EAAE,MAAM,MAAM,CAAC;IACtB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,OAAO,EAAE,MAAM,OAAO,CAAC;IACvB,SAAS,EAAE,MAAM,YAAY,GAAG,IAAI,CAAC;CACtC;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,MAAM,IAAI,CAAC;IACrC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED,eAAO,MAAM,MAAM,mGA6PjB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
export interface EditorToolbarProps {
|
|
3
|
+
editor: Editor | null;
|
|
4
|
+
readOnly?: boolean;
|
|
5
|
+
onMathDialogOpen?: () => void;
|
|
6
|
+
onImagePicker?: () => void;
|
|
7
|
+
}
|
|
8
|
+
declare const EditorToolbar: (props: EditorToolbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default EditorToolbar;
|
|
10
|
+
//# sourceMappingURL=EditorToolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorToolbar.d.ts","sourceRoot":"","sources":["../../src/components/EditorToolbar.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,QAAA,MAAM,aAAa,GAAI,OAAO,kBAAkB,4CAkC/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Component, ErrorInfo, ReactNode } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
fallback?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
interface State {
|
|
7
|
+
hasError: boolean;
|
|
8
|
+
error?: Error;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Error Boundary component to catch and handle errors in the editor
|
|
12
|
+
*/
|
|
13
|
+
declare class ErrorBoundary extends Component<Props, State> {
|
|
14
|
+
constructor(props: Props);
|
|
15
|
+
static getDerivedStateFromError(error: Error): State;
|
|
16
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
17
|
+
render(): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
18
|
+
}
|
|
19
|
+
export default ErrorBoundary;
|
|
20
|
+
//# sourceMappingURL=ErrorBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../src/components/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,UAAU,KAAK;IACb,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,UAAU,KAAK;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;GAEG;AACH,cAAM,aAAc,SAAQ,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;gBACrC,KAAK,EAAE,KAAK;IAKxB,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;IAIpD,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS;IAIpD,MAAM;CA0CP;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface ImagePickerDialogProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onImageSelect: (items: Array<{
|
|
6
|
+
src: string;
|
|
7
|
+
alt?: string;
|
|
8
|
+
mediaType?: "image" | "svg";
|
|
9
|
+
svgContent?: string;
|
|
10
|
+
}>) => void;
|
|
11
|
+
onUploadClick?: () => void;
|
|
12
|
+
}
|
|
13
|
+
declare const ImagePickerDialog: React.FC<ImagePickerDialogProps>;
|
|
14
|
+
export default ImagePickerDialog;
|
|
15
|
+
//# sourceMappingURL=ImagePickerDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImagePickerDialog.d.ts","sourceRoot":"","sources":["../../src/components/ImagePickerDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAYxE,UAAU,sBAAsB;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,CACb,KAAK,EAAE,KAAK,CAAC;QACX,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;QAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,KACC,IAAI,CAAC;IACV,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAsBD,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAwQvD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingOverlay.d.ts","sourceRoot":"","sources":["../../src/components/LoadingOverlay.tsx"],"names":[],"mappings":"AAAA,QAAA,MAAM,cAAc,GAAI,eAAe;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE,4CAU5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MathfieldElement } from '../types/mathlive';
|
|
3
|
+
declare global {
|
|
4
|
+
namespace JSX {
|
|
5
|
+
interface IntrinsicElements {
|
|
6
|
+
"math-field": React.DetailedHTMLProps<React.HTMLAttributes<MathfieldElement>, MathfieldElement> & {
|
|
7
|
+
ref?: React.Ref<MathfieldElement>;
|
|
8
|
+
value?: string;
|
|
9
|
+
onInput?: (event: any) => void;
|
|
10
|
+
"virtual-keyboard-mode"?: string;
|
|
11
|
+
"math-mode"?: string;
|
|
12
|
+
"smart-mode"?: string;
|
|
13
|
+
"smart-fence"?: string;
|
|
14
|
+
"smart-superscript"?: string;
|
|
15
|
+
"smart-subscript"?: string;
|
|
16
|
+
"smart-operator"?: string;
|
|
17
|
+
"smart-fraction"?: string;
|
|
18
|
+
"smart-sqrt"?: string;
|
|
19
|
+
"smart-bracket"?: string;
|
|
20
|
+
"smart-paren"?: string;
|
|
21
|
+
"smart-quote"?: string;
|
|
22
|
+
"smart-space"?: string;
|
|
23
|
+
"smart-command"?: string;
|
|
24
|
+
"menu-items"?: string;
|
|
25
|
+
"menu-toggle"?: string;
|
|
26
|
+
"menu-toggle-visible"?: string;
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
interface MathEquationDialogProps {
|
|
33
|
+
onClose: () => void;
|
|
34
|
+
onInsert: (latex: string, displayMode?: boolean) => void;
|
|
35
|
+
initialValue?: string;
|
|
36
|
+
}
|
|
37
|
+
declare const MathEquationDialog: React.ForwardRefExoticComponent<MathEquationDialogProps & React.RefAttributes<HTMLDivElement>>;
|
|
38
|
+
export default MathEquationDialog;
|
|
39
|
+
//# sourceMappingURL=MathEquationDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MathEquationDialog.d.ts","sourceRoot":"","sources":["../../src/components/MathEquationDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAE3E,OAAO,kCAAkC,CAAC;AAK1C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,YAAY,EAAE,KAAK,CAAC,iBAAiB,CACnC,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,EACtC,gBAAgB,CACjB,GAAG;gBACF,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;gBAClC,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;gBAC/B,uBAAuB,CAAC,EAAE,MAAM,CAAC;gBACjC,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,aAAa,CAAC,EAAE,MAAM,CAAC;gBACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;gBAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;gBAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;gBAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;gBAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,eAAe,CAAC,EAAE,MAAM,CAAC;gBACzB,aAAa,CAAC,EAAE,MAAM,CAAC;gBACvB,aAAa,CAAC,EAAE,MAAM,CAAC;gBACvB,aAAa,CAAC,EAAE,MAAM,CAAC;gBACvB,eAAe,CAAC,EAAE,MAAM,CAAC;gBACzB,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,aAAa,CAAC,EAAE,MAAM,CAAC;gBACvB,qBAAqB,CAAC,EAAE,MAAM,CAAC;gBAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;aACpB,CAAC;SACH;KACF;CACF;AAKD,UAAU,uBAAuB;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAsBD,QAAA,MAAM,kBAAkB,gGAkcvB,CAAC;AAIF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface ModalPortalProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Render modals on document.body so host app layout (transform, overflow,
|
|
7
|
+
* nested forms) cannot break fixed positioning or sizing.
|
|
8
|
+
*/
|
|
9
|
+
export default function ModalPortal({ children }: ModalPortalProps): import('react').ReactPortal | null;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=ModalPortal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalPortal.d.ts","sourceRoot":"","sources":["../../src/components/ModalPortal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAG5D,UAAU,gBAAgB;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE,gBAAgB,sCAiBjE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Node } from '@tiptap/pm/model';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
interface ImageNodeAttrs {
|
|
4
|
+
src: string;
|
|
5
|
+
alt?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
width?: string;
|
|
8
|
+
height?: string;
|
|
9
|
+
align?: string;
|
|
10
|
+
mediaType?: "image" | "svg";
|
|
11
|
+
svgContent?: string | null;
|
|
12
|
+
}
|
|
13
|
+
interface ResizableImageViewProps {
|
|
14
|
+
node: Node & {
|
|
15
|
+
attrs: ImageNodeAttrs;
|
|
16
|
+
};
|
|
17
|
+
updateAttributes: (attrs: Partial<ImageNodeAttrs>) => void;
|
|
18
|
+
selected?: boolean;
|
|
19
|
+
}
|
|
20
|
+
declare const ResizableImageView: React.FC<ResizableImageViewProps>;
|
|
21
|
+
export default ResizableImageView;
|
|
22
|
+
//# sourceMappingURL=ResizableImageView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResizableImageView.d.ts","sourceRoot":"","sources":["../../src/components/ResizableImageView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,KAAuC,MAAM,OAAO,CAAC;AAG5D,OAAO,0BAA0B,CAAC;AAElC,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,UAAU,uBAAuB;IAC/B,IAAI,EAAE,IAAI,GAAG;QACX,KAAK,EAAE,cAAc,CAAC;KACvB,CAAC;IACF,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAID,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA8OzD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Node } from '@tiptap/pm/model';
|
|
3
|
+
interface YoutubeNodeAttrs {
|
|
4
|
+
src: string;
|
|
5
|
+
width: string;
|
|
6
|
+
height: string;
|
|
7
|
+
align: string;
|
|
8
|
+
}
|
|
9
|
+
interface ResizableYoutubeViewProps {
|
|
10
|
+
node: Node & {
|
|
11
|
+
attrs: YoutubeNodeAttrs;
|
|
12
|
+
};
|
|
13
|
+
updateAttributes: (attrs: Partial<YoutubeNodeAttrs>) => void;
|
|
14
|
+
selected?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare const ResizableYoutubeView: React.FC<ResizableYoutubeViewProps>;
|
|
17
|
+
export default ResizableYoutubeView;
|
|
18
|
+
//# sourceMappingURL=ResizableYoutubeView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResizableYoutubeView.d.ts","sourceRoot":"","sources":["../../src/components/ResizableYoutubeView.tsx"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AACpC,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,yBAAyB;IACjC,IAAI,EAAE,IAAI,GAAG;QACX,KAAK,EAAE,gBAAgB,CAAC;KACzB,CAAC;IACF,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAKD,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAwK7D,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
interface TableControlsProps {
|
|
3
|
+
editor: Editor | null;
|
|
4
|
+
readOnly?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const TableControls: ({ editor, readOnly }: TableControlsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export default TableControls;
|
|
8
|
+
//# sourceMappingURL=TableControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableControls.d.ts","sourceRoot":"","sources":["../../src/components/TableControls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAG5C,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,aAAa,GAAI,sBAAsB,kBAAkB,mDA0E9D,CAAC;AAEF,eAAe,aAAa,CAAC"}
|