@vizel/react 0.0.1-alpha.6 → 1.1.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/README.md +41 -17
- package/dist/index.d.ts +331 -1
- package/dist/index.js +63 -47
- package/dist/index10.js +52 -45
- package/dist/index13.js +1 -1
- package/dist/index14.js +55 -51
- package/dist/index16.js +1 -1
- package/dist/index19.js +1 -1
- package/dist/index2.js +1 -1
- package/dist/index20.js +152 -8
- package/dist/index21.js +8 -10
- package/dist/index22.js +10 -78
- package/dist/index23.js +75 -112
- package/dist/index24.js +112 -32
- package/dist/index25.js +35 -5
- package/dist/index26.js +5 -68
- package/dist/index27.js +65 -88
- package/dist/index28.js +91 -4
- package/dist/index29.js +4 -36
- package/dist/index30.js +34 -51
- package/dist/index31.js +53 -33
- package/dist/index32.js +12 -50
- package/dist/index33.js +25 -29
- package/dist/index34.js +30 -7
- package/dist/index35.js +4 -52
- package/dist/index36.js +32 -10
- package/dist/index37.js +51 -15
- package/dist/index38.js +49 -3
- package/dist/index39.js +71 -20
- package/dist/index40.js +46 -2
- package/dist/index41.js +7 -9741
- package/dist/index42.js +52 -17015
- package/dist/index43.js +12 -2
- package/dist/index44.js +53 -7
- package/dist/index45.js +15 -2
- package/dist/index46.js +3 -2
- package/dist/index47.js +18 -219
- package/dist/index48.js +2 -225
- package/dist/index49.js +9742 -2
- package/dist/index50.js +17016 -2
- package/dist/index51.js +4 -0
- package/dist/index52.js +10 -0
- package/dist/index53.js +4 -0
- package/dist/index54.js +4 -0
- package/dist/index55.js +224 -0
- package/dist/index56.js +227 -0
- package/dist/index57.js +4 -0
- package/dist/index58.js +4 -0
- package/package.json +36 -16
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @vizel/react
|
|
2
2
|
|
|
3
|
-
React components for Vizel block-based Markdown editor.
|
|
3
|
+
React 19 components and hooks for Vizel block-based Markdown editor.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @vizel/react
|
|
8
|
+
npm install @vizel/react
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Requirements
|
|
@@ -22,7 +22,7 @@ import { Vizel } from "@vizel/react";
|
|
|
22
22
|
import "@vizel/core/styles.css";
|
|
23
23
|
|
|
24
24
|
function App() {
|
|
25
|
-
return <Vizel />;
|
|
25
|
+
return <Vizel placeholder="Type '/' for commands..." />;
|
|
26
26
|
}
|
|
27
27
|
```
|
|
28
28
|
|
|
@@ -33,12 +33,16 @@ import { VizelEditor, VizelBubbleMenu, useVizelEditor } from "@vizel/react";
|
|
|
33
33
|
import "@vizel/core/styles.css";
|
|
34
34
|
|
|
35
35
|
function App() {
|
|
36
|
-
const editor = useVizelEditor(
|
|
36
|
+
const editor = useVizelEditor({
|
|
37
|
+
features: {
|
|
38
|
+
image: { onUpload: async (file) => "https://example.com/image.png" },
|
|
39
|
+
},
|
|
40
|
+
});
|
|
37
41
|
|
|
38
42
|
return (
|
|
39
43
|
<>
|
|
40
|
-
<VizelEditor editor={editor
|
|
41
|
-
<VizelBubbleMenu editor={editor
|
|
44
|
+
<VizelEditor editor={editor} />
|
|
45
|
+
{editor && <VizelBubbleMenu editor={editor} />}
|
|
42
46
|
</>
|
|
43
47
|
);
|
|
44
48
|
}
|
|
@@ -51,14 +55,9 @@ import { useVizelEditor, useVizelMarkdown } from "@vizel/react";
|
|
|
51
55
|
|
|
52
56
|
function App() {
|
|
53
57
|
const editor = useVizelEditor();
|
|
54
|
-
const {
|
|
55
|
-
|
|
56
|
-
const handleExport = () => {
|
|
57
|
-
const markdown = getMarkdown();
|
|
58
|
-
console.log(markdown);
|
|
59
|
-
};
|
|
58
|
+
const { markdown, setMarkdown } = useVizelMarkdown(() => editor);
|
|
60
59
|
|
|
61
|
-
return <VizelEditor editor={editor
|
|
60
|
+
return <VizelEditor editor={editor} />;
|
|
62
61
|
}
|
|
63
62
|
```
|
|
64
63
|
|
|
@@ -66,20 +65,45 @@ function App() {
|
|
|
66
65
|
|
|
67
66
|
| Component | Description |
|
|
68
67
|
|-----------|-------------|
|
|
69
|
-
| `Vizel` | All-in-one editor with bubble menu |
|
|
68
|
+
| `Vizel` | All-in-one editor with bubble menu and optional toolbar |
|
|
70
69
|
| `VizelEditor` | Editor component |
|
|
71
70
|
| `VizelBubbleMenu` | Floating formatting toolbar |
|
|
71
|
+
| `VizelBubbleMenuDefault` | Default bubble menu layout |
|
|
72
|
+
| `VizelBubbleMenuButton` | Bubble menu button |
|
|
73
|
+
| `VizelBubbleMenuDivider` | Bubble menu divider |
|
|
74
|
+
| `VizelBubbleMenuColorPicker` | Bubble menu color picker |
|
|
72
75
|
| `VizelSlashMenu` | Slash command menu |
|
|
76
|
+
| `VizelSlashMenuItem` | Slash command menu item |
|
|
77
|
+
| `VizelSlashMenuEmpty` | Slash command empty state |
|
|
78
|
+
| `VizelToolbar` | Fixed toolbar |
|
|
79
|
+
| `VizelToolbarDefault` | Default toolbar layout |
|
|
80
|
+
| `VizelToolbarButton` | Toolbar button |
|
|
81
|
+
| `VizelToolbarDivider` | Toolbar divider |
|
|
82
|
+
| `VizelLinkEditor` | Link editing popover |
|
|
83
|
+
| `VizelNodeSelector` | Node type selector |
|
|
84
|
+
| `VizelColorPicker` | Color picker |
|
|
85
|
+
| `VizelFindReplace` | Find and replace panel |
|
|
86
|
+
| `VizelSaveIndicator` | Auto-save status indicator |
|
|
87
|
+
| `VizelEmbedView` | Embed content viewer |
|
|
73
88
|
| `VizelIconProvider` | Custom icon provider |
|
|
89
|
+
| `VizelThemeProvider` | Theme provider |
|
|
90
|
+
| `VizelProvider` | Editor context provider |
|
|
91
|
+
| `VizelPortal` | Portal component |
|
|
74
92
|
|
|
75
93
|
## Hooks
|
|
76
94
|
|
|
77
95
|
| Hook | Description |
|
|
78
96
|
|------|-------------|
|
|
79
97
|
| `useVizelEditor` | Create and manage editor instance |
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
98
|
+
| `useVizelEditorState` | Track editor state changes |
|
|
99
|
+
| `useVizelState` | Trigger re-renders on editor updates |
|
|
100
|
+
| `useVizelMarkdown` | Two-way Markdown synchronization |
|
|
101
|
+
| `useVizelAutoSave` | Auto-save to localStorage or custom backend |
|
|
102
|
+
| `useVizelCollaboration` | Real-time collaboration management |
|
|
103
|
+
| `useVizelComment` | Comment and annotation management |
|
|
104
|
+
| `useVizelVersionHistory` | Document version history |
|
|
105
|
+
| `useVizelContext` | Access editor from context |
|
|
106
|
+
| `useVizelTheme` | Access theme from context |
|
|
83
107
|
|
|
84
108
|
## Documentation
|
|
85
109
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ComponentProps } from 'react';
|
|
|
2
2
|
import { CustomIconMap } from '@vizel/core';
|
|
3
3
|
import { default as default_2 } from 'react';
|
|
4
4
|
import { Editor } from '@vizel/core';
|
|
5
|
+
import { Extensions } from '@vizel/core';
|
|
5
6
|
import { Icon } from '@iconify/react';
|
|
6
7
|
import { JSONContent } from '@vizel/core';
|
|
7
8
|
import { JSX } from 'react/jsx-runtime';
|
|
@@ -9,7 +10,12 @@ import { ReactNode } from 'react';
|
|
|
9
10
|
import { Ref } from 'react';
|
|
10
11
|
import { SuggestionOptions } from '@vizel/core';
|
|
11
12
|
import { VizelAutoSaveOptions } from '@vizel/core';
|
|
13
|
+
import { VizelCollaborationOptions } from '@vizel/core';
|
|
14
|
+
import { VizelCollaborationUser } from '@vizel/core';
|
|
12
15
|
import { VizelColorDefinition } from '@vizel/core';
|
|
16
|
+
import { VizelComment } from '@vizel/core';
|
|
17
|
+
import { VizelCommentOptions } from '@vizel/core';
|
|
18
|
+
import { VizelCommentReply } from '@vizel/core';
|
|
13
19
|
import { VizelCreateEditorOptions } from '@vizel/core';
|
|
14
20
|
import { VizelEditorState } from '@vizel/core';
|
|
15
21
|
import { VizelEmbedData } from '@vizel/core';
|
|
@@ -24,6 +30,10 @@ import { VizelSlashCommandItem } from '@vizel/core';
|
|
|
24
30
|
import { VizelSlashMenuRendererOptions } from '@vizel/core';
|
|
25
31
|
import { VizelThemeProviderOptions } from '@vizel/core';
|
|
26
32
|
import { VizelThemeState } from '@vizel/core';
|
|
33
|
+
import { VizelToolbarAction } from '@vizel/core';
|
|
34
|
+
import { VizelVersionHistoryOptions } from '@vizel/core';
|
|
35
|
+
import { VizelVersionSnapshot } from '@vizel/core';
|
|
36
|
+
import { VizelYjsProvider } from '@vizel/core';
|
|
27
37
|
|
|
28
38
|
/**
|
|
29
39
|
* Creates a suggestion render configuration for the SlashCommand extension.
|
|
@@ -91,6 +101,148 @@ export declare interface UseVizelAutoSaveResult {
|
|
|
91
101
|
restore: () => Promise<JSONContent | null>;
|
|
92
102
|
}
|
|
93
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Hook for tracking real-time collaboration state with a Yjs provider.
|
|
106
|
+
*
|
|
107
|
+
* This hook manages event listeners on the provider to track connection status,
|
|
108
|
+
* sync state, and peer count. It does NOT create the Yjs document or provider —
|
|
109
|
+
* users must create those themselves and pass them in.
|
|
110
|
+
*
|
|
111
|
+
* @param getProvider - Function that returns the Yjs provider instance
|
|
112
|
+
* @param options - Collaboration options including user info and callbacks
|
|
113
|
+
* @returns Collaboration state and controls
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```tsx
|
|
117
|
+
* import * as Y from "yjs";
|
|
118
|
+
* import { WebsocketProvider } from "y-websocket";
|
|
119
|
+
* import Collaboration from "@tiptap/extension-collaboration";
|
|
120
|
+
* import CollaborationCursor from "@tiptap/extension-collaboration-cursor";
|
|
121
|
+
* import { useVizelEditor, useVizelCollaboration } from "@vizel/react";
|
|
122
|
+
*
|
|
123
|
+
* function CollaborativeEditor() {
|
|
124
|
+
* const [doc] = useState(() => new Y.Doc());
|
|
125
|
+
* const [provider] = useState(
|
|
126
|
+
* () => new WebsocketProvider("ws://localhost:1234", "my-doc", doc)
|
|
127
|
+
* );
|
|
128
|
+
*
|
|
129
|
+
* const { isConnected, peerCount } = useVizelCollaboration(
|
|
130
|
+
* () => provider,
|
|
131
|
+
* { user: { name: "Alice", color: "#ff0000" } }
|
|
132
|
+
* );
|
|
133
|
+
*
|
|
134
|
+
* const editor = useVizelEditor({
|
|
135
|
+
* features: { collaboration: true },
|
|
136
|
+
* extensions: [
|
|
137
|
+
* Collaboration.configure({ document: doc }),
|
|
138
|
+
* CollaborationCursor.configure({
|
|
139
|
+
* provider,
|
|
140
|
+
* user: { name: "Alice", color: "#ff0000" },
|
|
141
|
+
* }),
|
|
142
|
+
* ],
|
|
143
|
+
* });
|
|
144
|
+
*
|
|
145
|
+
* return (
|
|
146
|
+
* <div>
|
|
147
|
+
* <span>{isConnected ? "Connected" : "Disconnected"} ({peerCount} peers)</span>
|
|
148
|
+
* <VizelEditor editor={editor} />
|
|
149
|
+
* </div>
|
|
150
|
+
* );
|
|
151
|
+
* }
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
export declare function useVizelCollaboration(getProvider: () => VizelYjsProvider | null | undefined, options?: VizelCollaborationOptions): UseVizelCollaborationResult;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Collaboration hook result
|
|
158
|
+
*/
|
|
159
|
+
export declare interface UseVizelCollaborationResult {
|
|
160
|
+
/** Whether connected to the collaboration server */
|
|
161
|
+
isConnected: boolean;
|
|
162
|
+
/** Whether the initial document sync is complete */
|
|
163
|
+
isSynced: boolean;
|
|
164
|
+
/** Number of currently connected peers (including self) */
|
|
165
|
+
peerCount: number;
|
|
166
|
+
/** Last error that occurred */
|
|
167
|
+
error: Error | null;
|
|
168
|
+
/** Connect to the collaboration server */
|
|
169
|
+
connect: () => void;
|
|
170
|
+
/** Disconnect from the collaboration server */
|
|
171
|
+
disconnect: () => void;
|
|
172
|
+
/** Update the current user's cursor information */
|
|
173
|
+
updateUser: (user: VizelCollaborationUser) => void;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Hook for managing document comments and annotations.
|
|
178
|
+
*
|
|
179
|
+
* @param getEditor - Function that returns the editor instance
|
|
180
|
+
* @param options - Comment configuration options
|
|
181
|
+
* @returns Comment state and controls
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```tsx
|
|
185
|
+
* function Editor() {
|
|
186
|
+
* const editor = useVizelEditor({
|
|
187
|
+
* features: { comment: true },
|
|
188
|
+
* });
|
|
189
|
+
* const { comments, addComment, resolveComment, setActiveComment } =
|
|
190
|
+
* useVizelComment(() => editor, { key: "my-comments" });
|
|
191
|
+
*
|
|
192
|
+
* const handleAddComment = () => {
|
|
193
|
+
* const text = prompt("Enter comment:");
|
|
194
|
+
* if (text) addComment(text, "Author");
|
|
195
|
+
* };
|
|
196
|
+
*
|
|
197
|
+
* return (
|
|
198
|
+
* <div>
|
|
199
|
+
* <VizelEditor editor={editor} />
|
|
200
|
+
* <button onClick={handleAddComment}>Add Comment</button>
|
|
201
|
+
* <ul>
|
|
202
|
+
* {comments.map((c) => (
|
|
203
|
+
* <li key={c.id} onClick={() => setActiveComment(c.id)}>
|
|
204
|
+
* {c.text} {c.resolved ? "(resolved)" : ""}
|
|
205
|
+
* <button onClick={() => resolveComment(c.id)}>Resolve</button>
|
|
206
|
+
* </li>
|
|
207
|
+
* ))}
|
|
208
|
+
* </ul>
|
|
209
|
+
* </div>
|
|
210
|
+
* );
|
|
211
|
+
* }
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
export declare function useVizelComment(getEditor: () => Editor | null | undefined, options?: VizelCommentOptions): UseVizelCommentResult;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Comment hook result
|
|
218
|
+
*/
|
|
219
|
+
export declare interface UseVizelCommentResult {
|
|
220
|
+
/** All stored comments (newest first) */
|
|
221
|
+
comments: VizelComment[];
|
|
222
|
+
/** Currently active comment ID */
|
|
223
|
+
activeCommentId: string | null;
|
|
224
|
+
/** Whether comments are loading */
|
|
225
|
+
isLoading: boolean;
|
|
226
|
+
/** Last error that occurred */
|
|
227
|
+
error: Error | null;
|
|
228
|
+
/** Add a comment to the current selection */
|
|
229
|
+
addComment: (text: string, author?: string) => Promise<VizelComment | null>;
|
|
230
|
+
/** Remove a comment and its mark */
|
|
231
|
+
removeComment: (commentId: string) => Promise<void>;
|
|
232
|
+
/** Mark a comment as resolved */
|
|
233
|
+
resolveComment: (commentId: string) => Promise<boolean>;
|
|
234
|
+
/** Reopen a resolved comment */
|
|
235
|
+
reopenComment: (commentId: string) => Promise<boolean>;
|
|
236
|
+
/** Add a reply to a comment */
|
|
237
|
+
replyToComment: (commentId: string, text: string, author?: string) => Promise<VizelCommentReply | null>;
|
|
238
|
+
/** Set the active comment */
|
|
239
|
+
setActiveComment: (commentId: string | null) => void;
|
|
240
|
+
/** Load all comments from storage */
|
|
241
|
+
loadComments: () => Promise<VizelComment[]>;
|
|
242
|
+
/** Get a comment by its ID */
|
|
243
|
+
getCommentById: (commentId: string) => VizelComment | undefined;
|
|
244
|
+
}
|
|
245
|
+
|
|
94
246
|
/**
|
|
95
247
|
* Hook to access the editor instance from context.
|
|
96
248
|
*
|
|
@@ -296,6 +448,63 @@ export declare function useVizelTheme(): VizelThemeState;
|
|
|
296
448
|
*/
|
|
297
449
|
export declare function useVizelThemeSafe(): VizelThemeState | null;
|
|
298
450
|
|
|
451
|
+
/**
|
|
452
|
+
* Hook for managing document version history.
|
|
453
|
+
*
|
|
454
|
+
* @param getEditor - Function that returns the editor instance
|
|
455
|
+
* @param options - Version history configuration options
|
|
456
|
+
* @returns Version history state and controls
|
|
457
|
+
*
|
|
458
|
+
* @example
|
|
459
|
+
* ```tsx
|
|
460
|
+
* function Editor() {
|
|
461
|
+
* const editor = useVizelEditor({ ... });
|
|
462
|
+
* const { snapshots, saveVersion, restoreVersion } = useVizelVersionHistory(
|
|
463
|
+
* () => editor,
|
|
464
|
+
* { maxVersions: 20, key: 'my-doc-versions' }
|
|
465
|
+
* );
|
|
466
|
+
*
|
|
467
|
+
* return (
|
|
468
|
+
* <div>
|
|
469
|
+
* <VizelEditor editor={editor} />
|
|
470
|
+
* <button onClick={() => saveVersion("Manual save")}>Save Version</button>
|
|
471
|
+
* <ul>
|
|
472
|
+
* {snapshots.map(s => (
|
|
473
|
+
* <li key={s.id}>
|
|
474
|
+
* {s.description} - {new Date(s.timestamp).toLocaleString()}
|
|
475
|
+
* <button onClick={() => restoreVersion(s.id)}>Restore</button>
|
|
476
|
+
* </li>
|
|
477
|
+
* ))}
|
|
478
|
+
* </ul>
|
|
479
|
+
* </div>
|
|
480
|
+
* );
|
|
481
|
+
* }
|
|
482
|
+
* ```
|
|
483
|
+
*/
|
|
484
|
+
export declare function useVizelVersionHistory(getEditor: () => Editor | null | undefined, options?: VizelVersionHistoryOptions): UseVizelVersionHistoryResult;
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Version history hook result
|
|
488
|
+
*/
|
|
489
|
+
export declare interface UseVizelVersionHistoryResult {
|
|
490
|
+
/** All stored snapshots (newest first) */
|
|
491
|
+
snapshots: VizelVersionSnapshot[];
|
|
492
|
+
/** Whether history is loading */
|
|
493
|
+
isLoading: boolean;
|
|
494
|
+
/** Last error that occurred */
|
|
495
|
+
error: Error | null;
|
|
496
|
+
/** Save current document as a new version */
|
|
497
|
+
saveVersion: (description?: string, author?: string) => Promise<VizelVersionSnapshot | null>;
|
|
498
|
+
/** Restore document to a specific version */
|
|
499
|
+
restoreVersion: (versionId: string) => Promise<boolean>;
|
|
500
|
+
/** Load all versions from storage */
|
|
501
|
+
loadVersions: () => Promise<VizelVersionSnapshot[]>;
|
|
502
|
+
/** Delete a specific version */
|
|
503
|
+
deleteVersion: (versionId: string) => Promise<void>;
|
|
504
|
+
/** Delete all versions */
|
|
505
|
+
clearVersions: () => Promise<void>;
|
|
506
|
+
}
|
|
507
|
+
|
|
299
508
|
/**
|
|
300
509
|
* Vizel - All-in-one editor component
|
|
301
510
|
*
|
|
@@ -333,7 +542,7 @@ export declare function useVizelThemeSafe(): VizelThemeState | null;
|
|
|
333
542
|
* }
|
|
334
543
|
* ```
|
|
335
544
|
*/
|
|
336
|
-
export declare function Vizel({ ref, initialContent, initialMarkdown, transformDiagramsOnImport, placeholder, editable, autofocus, features, className, showBubbleMenu, enableEmbed, bubbleMenuContent, children, onUpdate, onCreate, onDestroy, onSelectionUpdate, onFocus, onBlur, }: VizelProps): ReactNode;
|
|
545
|
+
export declare function Vizel({ ref, initialContent, initialMarkdown, transformDiagramsOnImport, placeholder, editable, autofocus, features, extensions, className, showToolbar, toolbarContent, showBubbleMenu, enableEmbed, bubbleMenuContent, children, onUpdate, onCreate, onDestroy, onSelectionUpdate, onFocus, onBlur, }: VizelProps): ReactNode;
|
|
337
546
|
|
|
338
547
|
/**
|
|
339
548
|
* A floating menu that appears when text is selected.
|
|
@@ -556,6 +765,20 @@ export declare interface VizelExposed {
|
|
|
556
765
|
container: HTMLDivElement | null;
|
|
557
766
|
}
|
|
558
767
|
|
|
768
|
+
/**
|
|
769
|
+
* Find & Replace panel component for React
|
|
770
|
+
*/
|
|
771
|
+
export declare function VizelFindReplace({ editor, className, onClose }: VizelFindReplaceProps): JSX.Element | null;
|
|
772
|
+
|
|
773
|
+
export declare interface VizelFindReplaceProps {
|
|
774
|
+
/** The Tiptap editor instance */
|
|
775
|
+
editor: Editor | null;
|
|
776
|
+
/** Custom class name */
|
|
777
|
+
className?: string;
|
|
778
|
+
/** Callback when the panel is closed */
|
|
779
|
+
onClose?: () => void;
|
|
780
|
+
}
|
|
781
|
+
|
|
559
782
|
/**
|
|
560
783
|
* Icon component that renders Iconify icons based on semantic icon names.
|
|
561
784
|
* Uses Lucide icons by default, but can be customized via:
|
|
@@ -764,8 +987,14 @@ export declare interface VizelProps {
|
|
|
764
987
|
autofocus?: boolean | "start" | "end" | "all" | number;
|
|
765
988
|
/** Feature configuration */
|
|
766
989
|
features?: VizelFeatureOptions;
|
|
990
|
+
/** Additional Tiptap extensions */
|
|
991
|
+
extensions?: Extensions;
|
|
767
992
|
/** Custom class name for the editor container */
|
|
768
993
|
className?: string;
|
|
994
|
+
/** Whether to show the toolbar (default: false) */
|
|
995
|
+
showToolbar?: boolean;
|
|
996
|
+
/** Custom toolbar content */
|
|
997
|
+
toolbarContent?: ReactNode;
|
|
769
998
|
/** Whether to show the bubble menu (default: true) */
|
|
770
999
|
showBubbleMenu?: boolean;
|
|
771
1000
|
/** Enable embed option in bubble menu link editor (requires Embed extension) */
|
|
@@ -962,4 +1191,105 @@ export declare interface VizelThemeProviderProps extends VizelThemeProviderOptio
|
|
|
962
1191
|
children: ReactNode;
|
|
963
1192
|
}
|
|
964
1193
|
|
|
1194
|
+
/**
|
|
1195
|
+
* Fixed toolbar component for the Vizel editor.
|
|
1196
|
+
* Displays formatting buttons above the editor content area.
|
|
1197
|
+
*
|
|
1198
|
+
* @example
|
|
1199
|
+
* ```tsx
|
|
1200
|
+
* // Default toolbar with all formatting buttons
|
|
1201
|
+
* <VizelToolbar editor={editor} />
|
|
1202
|
+
*
|
|
1203
|
+
* // Custom toolbar content
|
|
1204
|
+
* <VizelToolbar editor={editor}>
|
|
1205
|
+
* <VizelToolbarButton onClick={() => editor.chain().focus().toggleBold().run()}>
|
|
1206
|
+
* <strong>B</strong>
|
|
1207
|
+
* </VizelToolbarButton>
|
|
1208
|
+
* </VizelToolbar>
|
|
1209
|
+
* ```
|
|
1210
|
+
*/
|
|
1211
|
+
export declare function VizelToolbar({ editor: editorProp, className, showDefaultToolbar, children, }: VizelToolbarProps): JSX.Element | null;
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* A button component for use in the VizelToolbar.
|
|
1215
|
+
*
|
|
1216
|
+
* @example
|
|
1217
|
+
* ```tsx
|
|
1218
|
+
* <VizelToolbarButton
|
|
1219
|
+
* onClick={() => editor.chain().focus().toggleBold().run()}
|
|
1220
|
+
* isActive={editor.isActive("bold")}
|
|
1221
|
+
* title="Bold (Cmd+B)"
|
|
1222
|
+
* >
|
|
1223
|
+
* <VizelIcon name="bold" />
|
|
1224
|
+
* </VizelToolbarButton>
|
|
1225
|
+
* ```
|
|
1226
|
+
*/
|
|
1227
|
+
export declare function VizelToolbarButton({ onClick, isActive, disabled, children, title, className, action, }: VizelToolbarButtonProps): JSX.Element;
|
|
1228
|
+
|
|
1229
|
+
export declare interface VizelToolbarButtonProps {
|
|
1230
|
+
/** Click handler */
|
|
1231
|
+
onClick?: () => void;
|
|
1232
|
+
/** Whether the action is currently active */
|
|
1233
|
+
isActive?: boolean;
|
|
1234
|
+
/** Whether the button is disabled */
|
|
1235
|
+
disabled?: boolean;
|
|
1236
|
+
/** Button content (typically an icon) */
|
|
1237
|
+
children: ReactNode;
|
|
1238
|
+
/** Tooltip text */
|
|
1239
|
+
title?: string;
|
|
1240
|
+
/** Additional CSS class name */
|
|
1241
|
+
className?: string;
|
|
1242
|
+
/** Action identifier for testing */
|
|
1243
|
+
action?: string;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
/**
|
|
1247
|
+
* The default toolbar content for VizelToolbar.
|
|
1248
|
+
* Provides formatting buttons grouped by category with dividers between groups.
|
|
1249
|
+
*
|
|
1250
|
+
* @example
|
|
1251
|
+
* ```tsx
|
|
1252
|
+
* <VizelToolbar>
|
|
1253
|
+
* <VizelToolbarDefault editor={editor} />
|
|
1254
|
+
* </VizelToolbar>
|
|
1255
|
+
* ```
|
|
1256
|
+
*/
|
|
1257
|
+
export declare function VizelToolbarDefault({ editor, className, actions, }: VizelToolbarDefaultProps): JSX.Element;
|
|
1258
|
+
|
|
1259
|
+
export declare interface VizelToolbarDefaultProps {
|
|
1260
|
+
editor: Editor;
|
|
1261
|
+
className?: string;
|
|
1262
|
+
/** Custom toolbar actions (defaults to vizelDefaultToolbarActions) */
|
|
1263
|
+
actions?: VizelToolbarAction[];
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* A divider component for separating groups of buttons in the VizelToolbar.
|
|
1268
|
+
*
|
|
1269
|
+
* @example
|
|
1270
|
+
* ```tsx
|
|
1271
|
+
* <VizelToolbar>
|
|
1272
|
+
* <VizelToolbarButton>B</VizelToolbarButton>
|
|
1273
|
+
* <VizelToolbarDivider />
|
|
1274
|
+
* <VizelToolbarButton>H1</VizelToolbarButton>
|
|
1275
|
+
* </VizelToolbar>
|
|
1276
|
+
* ```
|
|
1277
|
+
*/
|
|
1278
|
+
export declare function VizelToolbarDivider({ className }: VizelToolbarDividerProps): JSX.Element;
|
|
1279
|
+
|
|
1280
|
+
export declare interface VizelToolbarDividerProps {
|
|
1281
|
+
className?: string;
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
export declare interface VizelToolbarProps {
|
|
1285
|
+
/** Editor instance. Falls back to context if not provided. */
|
|
1286
|
+
editor?: Editor | null;
|
|
1287
|
+
/** Additional CSS class name */
|
|
1288
|
+
className?: string;
|
|
1289
|
+
/** Whether to show the default toolbar (default: true). Set to false when using custom children. */
|
|
1290
|
+
showDefaultToolbar?: boolean;
|
|
1291
|
+
/** Custom toolbar content. When provided, replaces the default toolbar. */
|
|
1292
|
+
children?: ReactNode;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
965
1295
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -6,63 +6,79 @@ import "./index6.js";
|
|
|
6
6
|
import "./index7.js";
|
|
7
7
|
import "./index8.js";
|
|
8
8
|
import "./index9.js";
|
|
9
|
-
import { Vizel as
|
|
9
|
+
import { Vizel as z } from "./index10.js";
|
|
10
10
|
import { VizelBubbleMenu as u } from "./index11.js";
|
|
11
11
|
import { VizelBubbleMenuButton as a } from "./index12.js";
|
|
12
|
-
import { VizelBubbleMenuColorPicker as
|
|
12
|
+
import { VizelBubbleMenuColorPicker as b } from "./index13.js";
|
|
13
13
|
import { VizelBubbleMenuDefault as S } from "./index14.js";
|
|
14
14
|
import { VizelBubbleMenuDivider as c } from "./index15.js";
|
|
15
15
|
import { VizelColorPicker as v } from "./index16.js";
|
|
16
|
-
import { useVizelContext as
|
|
17
|
-
import { VizelEditor as
|
|
18
|
-
import { VizelEmbedView as
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
16
|
+
import { useVizelContext as C, useVizelContextSafe as T } from "./index17.js";
|
|
17
|
+
import { VizelEditor as P } from "./index18.js";
|
|
18
|
+
import { VizelEmbedView as k } from "./index19.js";
|
|
19
|
+
import { VizelFindReplace as w } from "./index20.js";
|
|
20
|
+
import { VizelIcon as R } from "./index21.js";
|
|
21
|
+
import { VizelIconProvider as F, useVizelIconContext as H } from "./index22.js";
|
|
22
|
+
import { VizelLinkEditor as N } from "./index23.js";
|
|
23
|
+
import { VizelNodeSelector as j } from "./index24.js";
|
|
24
|
+
import { VizelPortal as G } from "./index25.js";
|
|
25
|
+
import { VizelProvider as K } from "./index26.js";
|
|
26
|
+
import { VizelSaveIndicator as Q } from "./index27.js";
|
|
27
|
+
import { VizelSlashMenu as W } from "./index28.js";
|
|
28
|
+
import { VizelSlashMenuEmpty as Y } from "./index29.js";
|
|
29
|
+
import { VizelSlashMenuItem as _ } from "./index30.js";
|
|
30
|
+
import { VizelThemeProvider as ee, useVizelTheme as oe, useVizelThemeSafe as re } from "./index31.js";
|
|
31
|
+
import { VizelToolbar as ie } from "./index32.js";
|
|
32
|
+
import { VizelToolbarButton as me } from "./index33.js";
|
|
33
|
+
import { VizelToolbarDefault as Ve } from "./index34.js";
|
|
34
|
+
import { VizelToolbarDivider as ze } from "./index35.js";
|
|
35
|
+
import { createVizelSlashMenuRenderer as ue } from "./index36.js";
|
|
36
|
+
import { useVizelAutoSave as ae } from "./index37.js";
|
|
37
|
+
import { useVizelCollaboration as be } from "./index38.js";
|
|
38
|
+
import { useVizelComment as Se } from "./index39.js";
|
|
39
|
+
import { useVizelEditor as ce } from "./index40.js";
|
|
40
|
+
import { useVizelEditorState as ve } from "./index41.js";
|
|
41
|
+
import { useVizelMarkdown as Ce } from "./index42.js";
|
|
42
|
+
import { useVizelState as Ee } from "./index43.js";
|
|
43
|
+
import { useVizelVersionHistory as Ie } from "./index44.js";
|
|
36
44
|
export {
|
|
37
|
-
|
|
45
|
+
z as Vizel,
|
|
38
46
|
u as VizelBubbleMenu,
|
|
39
47
|
a as VizelBubbleMenuButton,
|
|
40
|
-
|
|
48
|
+
b as VizelBubbleMenuColorPicker,
|
|
41
49
|
S as VizelBubbleMenuDefault,
|
|
42
50
|
c as VizelBubbleMenuDivider,
|
|
43
51
|
v as VizelColorPicker,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
P as VizelEditor,
|
|
53
|
+
k as VizelEmbedView,
|
|
54
|
+
w as VizelFindReplace,
|
|
55
|
+
R as VizelIcon,
|
|
56
|
+
F as VizelIconProvider,
|
|
57
|
+
N as VizelLinkEditor,
|
|
49
58
|
j as VizelNodeSelector,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
G as VizelPortal,
|
|
60
|
+
K as VizelProvider,
|
|
61
|
+
Q as VizelSaveIndicator,
|
|
62
|
+
W as VizelSlashMenu,
|
|
63
|
+
Y as VizelSlashMenuEmpty,
|
|
64
|
+
_ as VizelSlashMenuItem,
|
|
65
|
+
ee as VizelThemeProvider,
|
|
66
|
+
ie as VizelToolbar,
|
|
67
|
+
me as VizelToolbarButton,
|
|
68
|
+
Ve as VizelToolbarDefault,
|
|
69
|
+
ze as VizelToolbarDivider,
|
|
70
|
+
ue as createVizelSlashMenuRenderer,
|
|
71
|
+
ae as useVizelAutoSave,
|
|
72
|
+
be as useVizelCollaboration,
|
|
73
|
+
Se as useVizelComment,
|
|
74
|
+
C as useVizelContext,
|
|
75
|
+
T as useVizelContextSafe,
|
|
76
|
+
ce as useVizelEditor,
|
|
77
|
+
ve as useVizelEditorState,
|
|
78
|
+
H as useVizelIconContext,
|
|
79
|
+
Ce as useVizelMarkdown,
|
|
80
|
+
Ee as useVizelState,
|
|
81
|
+
oe as useVizelTheme,
|
|
82
|
+
re as useVizelThemeSafe,
|
|
83
|
+
Ie as useVizelVersionHistory
|
|
68
84
|
};
|