@ixo/editor 2.5.0 → 2.7.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 +438 -438
- package/dist/{chunk-EEQXEWCQ.mjs → chunk-Z7FSLJDH.mjs} +4421 -760
- package/dist/chunk-Z7FSLJDH.mjs.map +1 -0
- package/dist/graphql-client-ppGpOvLH.d.ts +3134 -0
- package/dist/index.d.ts +130 -2579
- package/dist/index.mjs +33 -3
- package/dist/mantine/index.d.ts +2 -2
- package/dist/mantine/index.mjs +13 -1
- package/package.json +1 -1
- package/style.css.d.ts +5 -5
- package/dist/chunk-EEQXEWCQ.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,438 +1,438 @@
|
|
|
1
|
-
# IXO Editor
|
|
2
|
-
|
|
3
|
-
A custom BlockNote editor wrapper built specifically for the IXO team's needs. This package provides a highly customized rich text editing experience built on top of [BlockNote](https://www.blocknotejs.org/) with support for both **Shadcn UI** and **Mantine UI**.
|
|
4
|
-
|
|
5
|
-
> **Note**: This package is designed for internal IXO team use and is not intended for public consumption, though it is hosted publicly.
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
- 🎨 **Multi-UI Support**: Choose between Shadcn UI or Mantine UI components
|
|
10
|
-
- 🔧 **Simplified API**: Wrapped BlockNote functionality with sensible defaults
|
|
11
|
-
- 📝 **Rich Text Editing**: Full support for headings, lists, code blocks, tables, and more
|
|
12
|
-
- 🔗 **Custom Blocks**: Built-in custom blocks including dynamic List block for DID data
|
|
13
|
-
- 🖼️ **Media Support**: Image and file upload handling
|
|
14
|
-
- 🎯 **TypeScript**: Full TypeScript support with exported types
|
|
15
|
-
- 🤝 **Collaboration Ready**: Built-in Matrix-based collaborative editing with real-time synchronization
|
|
16
|
-
- 📱 **Responsive**: Mobile-friendly editor experience
|
|
17
|
-
- 💎 **Complete CSS Bundles**: Self-contained CSS with all dependencies included
|
|
18
|
-
|
|
19
|
-
## Installation
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npm install @ixo/editor
|
|
23
|
-
# or
|
|
24
|
-
yarn add @ixo/editor
|
|
25
|
-
# or
|
|
26
|
-
pnpm add @ixo/editor
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Quick Start
|
|
30
|
-
|
|
31
|
-
### Shadcn UI Version (Default)
|
|
32
|
-
|
|
33
|
-
```tsx
|
|
34
|
-
import React from 'react';
|
|
35
|
-
import { useCreateIxoEditor, IxoEditor } from '@ixo/editor/shadcn';
|
|
36
|
-
import '@ixo/editor/style-shadcn.css'; // Complete CSS bundle - no other imports needed!
|
|
37
|
-
|
|
38
|
-
function MyEditor() {
|
|
39
|
-
const editor = useCreateIxoEditor({
|
|
40
|
-
theme: 'light',
|
|
41
|
-
initialContent: [
|
|
42
|
-
{
|
|
43
|
-
type: 'heading',
|
|
44
|
-
content: 'Welcome to IXO Editor',
|
|
45
|
-
props: { level: 1 },
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
type: 'paragraph',
|
|
49
|
-
content: 'Start typing to create amazing content!',
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
return <IxoEditor editor={editor} onChange={() => console.log('Content changed')} />;
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Mantine UI Version
|
|
59
|
-
|
|
60
|
-
```tsx
|
|
61
|
-
import React from 'react';
|
|
62
|
-
import { MantineProvider } from '@mantine/core';
|
|
63
|
-
import { useCreateIxoEditor, IxoEditor } from '@ixo/editor/mantine';
|
|
64
|
-
import '@ixo/editor/style-mantine.css'; // Complete CSS bundle - no other imports needed!
|
|
65
|
-
|
|
66
|
-
function MyEditor() {
|
|
67
|
-
const editor = useCreateIxoEditor({
|
|
68
|
-
theme: 'light',
|
|
69
|
-
initialContent: [
|
|
70
|
-
{
|
|
71
|
-
type: 'heading',
|
|
72
|
-
content: 'Welcome to IXO Editor',
|
|
73
|
-
props: { level: 1 },
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<MantineProvider>
|
|
80
|
-
<IxoEditor editor={editor} onChange={() => console.log('Content changed')} />
|
|
81
|
-
</MantineProvider>
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## Import Options
|
|
87
|
-
|
|
88
|
-
The package provides flexible import patterns to suit your needs:
|
|
89
|
-
|
|
90
|
-
### Option 1: UI-Specific Imports (Recommended)
|
|
91
|
-
|
|
92
|
-
```tsx
|
|
93
|
-
// Shadcn version with complete CSS bundle
|
|
94
|
-
import { IxoEditor, useCreateIxoEditor } from '@ixo/editor/shadcn';
|
|
95
|
-
import '@ixo/editor/style-shadcn.css';
|
|
96
|
-
|
|
97
|
-
// Mantine version with complete CSS bundle
|
|
98
|
-
import { IxoEditor, useCreateIxoEditor } from '@ixo/editor/mantine';
|
|
99
|
-
import '@ixo/editor/style-mantine.css';
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Option 2: Default Import (Shadcn)
|
|
103
|
-
|
|
104
|
-
```tsx
|
|
105
|
-
// Uses Shadcn version by default for backward compatibility
|
|
106
|
-
import { IxoEditor, useCreateIxoEditor } from '@ixo/editor';
|
|
107
|
-
import '@ixo/editor/style.css';
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### CSS Bundle Options
|
|
111
|
-
|
|
112
|
-
- `@ixo/editor/style-shadcn.css` - Complete bundle: Inter fonts + Shadcn + IXO styles
|
|
113
|
-
- `@ixo/editor/style-mantine.css` - Complete bundle: Inter fonts + Mantine + IXO styles
|
|
114
|
-
- `@ixo/editor/style.css` - Default bundle (same as shadcn)
|
|
115
|
-
- `@ixo/editor/style-core.css` - Only IXO custom styles (for advanced users)
|
|
116
|
-
|
|
117
|
-
## API Reference
|
|
118
|
-
|
|
119
|
-
### `useCreateIxoEditor`
|
|
120
|
-
|
|
121
|
-
The main hook for creating an IXO editor instance. Available in both UI versions.
|
|
122
|
-
|
|
123
|
-
```tsx
|
|
124
|
-
const editor = useCreateIxoEditor(options?: IxoEditorOptions);
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
#### Options
|
|
128
|
-
|
|
129
|
-
| Option | Type | Default | Description |
|
|
130
|
-
| ------------------- | --------------------------------- | ------------------ | ----------------------------------------- |
|
|
131
|
-
| `theme` | `'light' \| 'dark'` | `'light'` | Editor color theme |
|
|
132
|
-
| `uploadFile` | `(file: File) => Promise<string>` | Data URL converter | File upload handler |
|
|
133
|
-
| `initialContent` | `PartialBlock[]` | `undefined` | Initial editor content |
|
|
134
|
-
| `editable` | `boolean` | `true` | Whether editor is editable |
|
|
135
|
-
| `sideMenu` | `boolean` | `true` | Show side menu (drag handle, plus button) |
|
|
136
|
-
| `slashMenu` | `boolean` | `true` | Enable slash commands menu |
|
|
137
|
-
| `formattingToolbar` | `boolean` | `true` | Show formatting toolbar |
|
|
138
|
-
| `linkToolbar` | `boolean` | `true` | Show link toolbar |
|
|
139
|
-
| `filePanel` | `boolean` | `true` | Show file panel |
|
|
140
|
-
| `tableHandles` | `boolean` | `true` | Show table manipulation handles |
|
|
141
|
-
|
|
142
|
-
### `IxoEditor` Component
|
|
143
|
-
|
|
144
|
-
The main editor component. Available in both UI versions with identical APIs.
|
|
145
|
-
|
|
146
|
-
```tsx
|
|
147
|
-
<IxoEditor
|
|
148
|
-
editor={editor}
|
|
149
|
-
className="my-custom-class"
|
|
150
|
-
onChange={() => {}}
|
|
151
|
-
onSelectionChange={() => {}}
|
|
152
|
-
/>
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
#### Props
|
|
156
|
-
|
|
157
|
-
| Prop | Type | Description |
|
|
158
|
-
| ------------------- | ------------------------------ | ----------------------------------------- |
|
|
159
|
-
| `editor` | `BlockNoteEditor \| undefined` | Editor instance from `useCreateIxoEditor` |
|
|
160
|
-
| `className` | `string` | Additional CSS classes |
|
|
161
|
-
| `onChange` | `() => void` | Callback when content changes |
|
|
162
|
-
| `onSelectionChange` | `() => void` | Callback when selection changes |
|
|
163
|
-
| `children` | `React.ReactNode` | Custom child components |
|
|
164
|
-
|
|
165
|
-
## Advanced Usage
|
|
166
|
-
|
|
167
|
-
### Custom File Upload
|
|
168
|
-
|
|
169
|
-
```tsx
|
|
170
|
-
const editor = useCreateIxoEditor({
|
|
171
|
-
uploadFile: async (file: File) => {
|
|
172
|
-
const formData = new FormData();
|
|
173
|
-
formData.append('file', file);
|
|
174
|
-
|
|
175
|
-
const response = await fetch('/api/upload', {
|
|
176
|
-
method: 'POST',
|
|
177
|
-
body: formData,
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
const { url } = await response.json();
|
|
181
|
-
return url;
|
|
182
|
-
},
|
|
183
|
-
});
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### Collaborative Editing
|
|
187
|
-
|
|
188
|
-
For real-time collaborative editing, use the `useCreateCollaborativeIxoEditor` hook with Matrix protocol:
|
|
189
|
-
|
|
190
|
-
```tsx
|
|
191
|
-
import { useCreateCollaborativeIxoEditor, IxoEditor } from '@ixo/editor/shadcn';
|
|
192
|
-
|
|
193
|
-
function CollaborativeEditor() {
|
|
194
|
-
const { editor, connectionStatus } = useCreateCollaborativeIxoEditor({
|
|
195
|
-
theme: 'light',
|
|
196
|
-
user: {
|
|
197
|
-
id: 'user-123',
|
|
198
|
-
name: 'John Doe',
|
|
199
|
-
color: '#FF5733',
|
|
200
|
-
accessToken: 'your-matrix-access-token',
|
|
201
|
-
address: 'your-user-address',
|
|
202
|
-
},
|
|
203
|
-
matrixClient: matrixClient,
|
|
204
|
-
roomId: '!roomId:matrix.org',
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
return (
|
|
208
|
-
<div>
|
|
209
|
-
<div>Connection: {connectionStatus}</div>
|
|
210
|
-
<IxoEditor editor={editor} />
|
|
211
|
-
</div>
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### Dark Theme
|
|
217
|
-
|
|
218
|
-
```tsx
|
|
219
|
-
const editor = useCreateIxoEditor({
|
|
220
|
-
theme: 'dark',
|
|
221
|
-
});
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
### Read-Only Mode
|
|
225
|
-
|
|
226
|
-
```tsx
|
|
227
|
-
const editor = useCreateIxoEditor({
|
|
228
|
-
editable: false,
|
|
229
|
-
sideMenu: false,
|
|
230
|
-
slashMenu: false,
|
|
231
|
-
formattingToolbar: false,
|
|
232
|
-
});
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
## Custom Blocks
|
|
236
|
-
|
|
237
|
-
The IXO Editor includes custom blocks for working with IXO ecosystem data, available in both UI versions:
|
|
238
|
-
|
|
239
|
-
### List Block
|
|
240
|
-
|
|
241
|
-
The List block displays dynamic data from DID and fragment identifiers, perfect for displaying data from your GraphQL API.
|
|
242
|
-
|
|
243
|
-
### Overview Block
|
|
244
|
-
|
|
245
|
-
The Overview block provides a comprehensive view of entity data from DID identifiers.
|
|
246
|
-
|
|
247
|
-
#### Usage
|
|
248
|
-
|
|
249
|
-
Both blocks can be inserted using the slash menu:
|
|
250
|
-
|
|
251
|
-
**List Block:**
|
|
252
|
-
|
|
253
|
-
1. Type `/list` in the editor
|
|
254
|
-
2. Or type `/` and search for "List", "data", or "dynamic"
|
|
255
|
-
3. Configure the DID and fragment identifier in the settings
|
|
256
|
-
|
|
257
|
-
**Overview Block:**
|
|
258
|
-
|
|
259
|
-
1. Type `/overview` in the editor
|
|
260
|
-
2. Or type `/` and search for "Overview", "overview-block", or "data-overview"
|
|
261
|
-
3. Configure the DID in the settings
|
|
262
|
-
|
|
263
|
-
#### Programmatic Usage
|
|
264
|
-
|
|
265
|
-
```tsx
|
|
266
|
-
// Insert a list block programmatically
|
|
267
|
-
editor.insertBlocks(
|
|
268
|
-
[
|
|
269
|
-
{
|
|
270
|
-
type: 'list',
|
|
271
|
-
props: {
|
|
272
|
-
title: 'My Data List',
|
|
273
|
-
did: 'did:ixo:entity123',
|
|
274
|
-
fragmentIdentifier: 'claims-data',
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
],
|
|
278
|
-
editor.getTextCursorPosition().block,
|
|
279
|
-
'after'
|
|
280
|
-
);
|
|
281
|
-
|
|
282
|
-
// Insert an overview block programmatically
|
|
283
|
-
editor.insertBlocks(
|
|
284
|
-
[
|
|
285
|
-
{
|
|
286
|
-
type: 'overview',
|
|
287
|
-
props: {
|
|
288
|
-
did: 'did:ixo:entity123',
|
|
289
|
-
},
|
|
290
|
-
},
|
|
291
|
-
],
|
|
292
|
-
editor.getTextCursorPosition().block,
|
|
293
|
-
'after'
|
|
294
|
-
);
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
## UI Library Comparison
|
|
298
|
-
|
|
299
|
-
| Feature | Shadcn UI | Mantine UI |
|
|
300
|
-
| ----------------- | -------------------- | --------------------- |
|
|
301
|
-
| **Bundle Size** | ~46KB CSS | ~173KB CSS |
|
|
302
|
-
| **Custom Blocks** | Full-featured | Minimal (expandable) |
|
|
303
|
-
| **Theming** | Tailwind-based | CSS-in-JS |
|
|
304
|
-
| **Dependencies** | Radix UI primitives | Mantine ecosystem |
|
|
305
|
-
| **Customization** | High (CSS variables) | High (theme provider) |
|
|
306
|
-
|
|
307
|
-
### When to Choose Shadcn UI
|
|
308
|
-
|
|
309
|
-
- ✅ You're already using Tailwind CSS
|
|
310
|
-
- ✅ You prefer smaller bundle sizes
|
|
311
|
-
- ✅ You want the full-featured custom blocks
|
|
312
|
-
- ✅ You like CSS variable-based theming
|
|
313
|
-
|
|
314
|
-
### When to Choose Mantine UI
|
|
315
|
-
|
|
316
|
-
- ✅ You're already using Mantine in your app
|
|
317
|
-
- ✅ You prefer component-based theming
|
|
318
|
-
- ✅ You want consistent Mantine design language
|
|
319
|
-
- ✅ You plan to enhance the minimal blocks with Mantine components
|
|
320
|
-
|
|
321
|
-
## Development
|
|
322
|
-
|
|
323
|
-
### Project Structure
|
|
324
|
-
|
|
325
|
-
```
|
|
326
|
-
ixo-editor/
|
|
327
|
-
├── src/
|
|
328
|
-
│ ├── core/ # Shared infrastructure
|
|
329
|
-
│ │ ├── types.ts # Shared types
|
|
330
|
-
│ │ ├── hooks/ # Matrix provider
|
|
331
|
-
│ │ └── lib/ # GraphQL client & utilities
|
|
332
|
-
│ ├── shadcn/ # Shadcn UI implementation
|
|
333
|
-
│ │ ├── IxoEditor.tsx
|
|
334
|
-
│ │ ├── blocks/ # Full-featured custom blocks
|
|
335
|
-
│ │ ├── components/ # Shadcn UI components
|
|
336
|
-
│ │ ├── hooks/ # Editor hooks
|
|
337
|
-
│ │ └── index.ts # Shadcn exports
|
|
338
|
-
│ ├── mantine/ # Mantine UI implementation
|
|
339
|
-
│ │ ├── IxoEditor.tsx
|
|
340
|
-
│ │ ├── blocks/ # Minimal custom blocks
|
|
341
|
-
│ │ ├── hooks/ # Editor hooks
|
|
342
|
-
│ │ └── index.ts # Mantine exports
|
|
343
|
-
│ ├── styles/ # Source CSS
|
|
344
|
-
│ │ └── ixo-editor.css
|
|
345
|
-
│ └── index.ts # Main entry (defaults to shadcn)
|
|
346
|
-
├── fonts/ # Inter font files
|
|
347
|
-
├── dist/ # Built JavaScript
|
|
348
|
-
│ ├── index.js # Main bundle
|
|
349
|
-
│ ├── shadcn/ # Shadcn bundle
|
|
350
|
-
│ └── mantine/ # Mantine bundle
|
|
351
|
-
├── style*.css # CSS bundles
|
|
352
|
-
└── package.json
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
### Building the Package
|
|
356
|
-
|
|
357
|
-
```bash
|
|
358
|
-
# Install dependencies
|
|
359
|
-
pnpm install
|
|
360
|
-
|
|
361
|
-
# Build the package (creates all bundles)
|
|
362
|
-
pnpm build
|
|
363
|
-
|
|
364
|
-
# Watch for changes during development
|
|
365
|
-
pnpm run dev
|
|
366
|
-
|
|
367
|
-
# Type checking
|
|
368
|
-
pnpm run type-check
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
## Requirements
|
|
372
|
-
|
|
373
|
-
- React 18.0.0 or higher
|
|
374
|
-
- React DOM 18.0.0 or higher
|
|
375
|
-
- Modern browser with ES2020 support
|
|
376
|
-
- For collaborative editing: Matrix server access
|
|
377
|
-
|
|
378
|
-
### Additional Requirements by UI Library
|
|
379
|
-
|
|
380
|
-
**For Mantine version:**
|
|
381
|
-
|
|
382
|
-
- `@mantine/core` ^8.0.0 (peer dependency)
|
|
383
|
-
- `@mantine/hooks` ^8.0.0 (peer dependency)
|
|
384
|
-
|
|
385
|
-
**For Shadcn version:**
|
|
386
|
-
|
|
387
|
-
- Works with existing Tailwind CSS setup
|
|
388
|
-
- No additional peer dependencies
|
|
389
|
-
|
|
390
|
-
## Migration Guide
|
|
391
|
-
|
|
392
|
-
### From v1.x to v2.x (Multi-UI)
|
|
393
|
-
|
|
394
|
-
**Before (v1.x):**
|
|
395
|
-
|
|
396
|
-
```tsx
|
|
397
|
-
import { IxoEditor } from '@ixo/editor';
|
|
398
|
-
import '@blocknote/shadcn/style.css';
|
|
399
|
-
import '@ixo/editor/style.css';
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
**After (v2.x) - Recommended:**
|
|
403
|
-
|
|
404
|
-
```tsx
|
|
405
|
-
// Explicit shadcn version with complete CSS bundle
|
|
406
|
-
import { IxoEditor } from '@ixo/editor/shadcn';
|
|
407
|
-
import '@ixo/editor/style-shadcn.css'; // Single import!
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
**After (v2.x) - Backward compatible:**
|
|
411
|
-
|
|
412
|
-
```tsx
|
|
413
|
-
// Still works! (defaults to shadcn)
|
|
414
|
-
import { IxoEditor } from '@ixo/editor';
|
|
415
|
-
import '@ixo/editor/style.css'; // Now includes all dependencies
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
## License
|
|
419
|
-
|
|
420
|
-
MIT © IXO Team
|
|
421
|
-
|
|
422
|
-
---
|
|
423
|
-
|
|
424
|
-
## Internal Notes
|
|
425
|
-
|
|
426
|
-
This package is maintained by the IXO development team. For questions or issues, please contact the team directly through internal channels.
|
|
427
|
-
|
|
428
|
-
### Version Management
|
|
429
|
-
|
|
430
|
-
Follow semantic versioning:
|
|
431
|
-
|
|
432
|
-
- Patch releases (0.0.x): Bug fixes and minor updates
|
|
433
|
-
- Minor releases (0.x.0): New features that are backward compatible
|
|
434
|
-
- Major releases (x.0.0): Breaking changes (like the multi-UI restructure)
|
|
435
|
-
|
|
436
|
-
### Contributing
|
|
437
|
-
|
|
438
|
-
This is an internal package. All contributions should go through the standard IXO development workflow and review process.
|
|
1
|
+
# IXO Editor
|
|
2
|
+
|
|
3
|
+
A custom BlockNote editor wrapper built specifically for the IXO team's needs. This package provides a highly customized rich text editing experience built on top of [BlockNote](https://www.blocknotejs.org/) with support for both **Shadcn UI** and **Mantine UI**.
|
|
4
|
+
|
|
5
|
+
> **Note**: This package is designed for internal IXO team use and is not intended for public consumption, though it is hosted publicly.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 🎨 **Multi-UI Support**: Choose between Shadcn UI or Mantine UI components
|
|
10
|
+
- 🔧 **Simplified API**: Wrapped BlockNote functionality with sensible defaults
|
|
11
|
+
- 📝 **Rich Text Editing**: Full support for headings, lists, code blocks, tables, and more
|
|
12
|
+
- 🔗 **Custom Blocks**: Built-in custom blocks including dynamic List block for DID data
|
|
13
|
+
- 🖼️ **Media Support**: Image and file upload handling
|
|
14
|
+
- 🎯 **TypeScript**: Full TypeScript support with exported types
|
|
15
|
+
- 🤝 **Collaboration Ready**: Built-in Matrix-based collaborative editing with real-time synchronization
|
|
16
|
+
- 📱 **Responsive**: Mobile-friendly editor experience
|
|
17
|
+
- 💎 **Complete CSS Bundles**: Self-contained CSS with all dependencies included
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @ixo/editor
|
|
23
|
+
# or
|
|
24
|
+
yarn add @ixo/editor
|
|
25
|
+
# or
|
|
26
|
+
pnpm add @ixo/editor
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
### Shadcn UI Version (Default)
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import React from 'react';
|
|
35
|
+
import { useCreateIxoEditor, IxoEditor } from '@ixo/editor/shadcn';
|
|
36
|
+
import '@ixo/editor/style-shadcn.css'; // Complete CSS bundle - no other imports needed!
|
|
37
|
+
|
|
38
|
+
function MyEditor() {
|
|
39
|
+
const editor = useCreateIxoEditor({
|
|
40
|
+
theme: 'light',
|
|
41
|
+
initialContent: [
|
|
42
|
+
{
|
|
43
|
+
type: 'heading',
|
|
44
|
+
content: 'Welcome to IXO Editor',
|
|
45
|
+
props: { level: 1 },
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'paragraph',
|
|
49
|
+
content: 'Start typing to create amazing content!',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return <IxoEditor editor={editor} onChange={() => console.log('Content changed')} />;
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Mantine UI Version
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import React from 'react';
|
|
62
|
+
import { MantineProvider } from '@mantine/core';
|
|
63
|
+
import { useCreateIxoEditor, IxoEditor } from '@ixo/editor/mantine';
|
|
64
|
+
import '@ixo/editor/style-mantine.css'; // Complete CSS bundle - no other imports needed!
|
|
65
|
+
|
|
66
|
+
function MyEditor() {
|
|
67
|
+
const editor = useCreateIxoEditor({
|
|
68
|
+
theme: 'light',
|
|
69
|
+
initialContent: [
|
|
70
|
+
{
|
|
71
|
+
type: 'heading',
|
|
72
|
+
content: 'Welcome to IXO Editor',
|
|
73
|
+
props: { level: 1 },
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<MantineProvider>
|
|
80
|
+
<IxoEditor editor={editor} onChange={() => console.log('Content changed')} />
|
|
81
|
+
</MantineProvider>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Import Options
|
|
87
|
+
|
|
88
|
+
The package provides flexible import patterns to suit your needs:
|
|
89
|
+
|
|
90
|
+
### Option 1: UI-Specific Imports (Recommended)
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
// Shadcn version with complete CSS bundle
|
|
94
|
+
import { IxoEditor, useCreateIxoEditor } from '@ixo/editor/shadcn';
|
|
95
|
+
import '@ixo/editor/style-shadcn.css';
|
|
96
|
+
|
|
97
|
+
// Mantine version with complete CSS bundle
|
|
98
|
+
import { IxoEditor, useCreateIxoEditor } from '@ixo/editor/mantine';
|
|
99
|
+
import '@ixo/editor/style-mantine.css';
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Option 2: Default Import (Shadcn)
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
// Uses Shadcn version by default for backward compatibility
|
|
106
|
+
import { IxoEditor, useCreateIxoEditor } from '@ixo/editor';
|
|
107
|
+
import '@ixo/editor/style.css';
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### CSS Bundle Options
|
|
111
|
+
|
|
112
|
+
- `@ixo/editor/style-shadcn.css` - Complete bundle: Inter fonts + Shadcn + IXO styles
|
|
113
|
+
- `@ixo/editor/style-mantine.css` - Complete bundle: Inter fonts + Mantine + IXO styles
|
|
114
|
+
- `@ixo/editor/style.css` - Default bundle (same as shadcn)
|
|
115
|
+
- `@ixo/editor/style-core.css` - Only IXO custom styles (for advanced users)
|
|
116
|
+
|
|
117
|
+
## API Reference
|
|
118
|
+
|
|
119
|
+
### `useCreateIxoEditor`
|
|
120
|
+
|
|
121
|
+
The main hook for creating an IXO editor instance. Available in both UI versions.
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
const editor = useCreateIxoEditor(options?: IxoEditorOptions);
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### Options
|
|
128
|
+
|
|
129
|
+
| Option | Type | Default | Description |
|
|
130
|
+
| ------------------- | --------------------------------- | ------------------ | ----------------------------------------- |
|
|
131
|
+
| `theme` | `'light' \| 'dark'` | `'light'` | Editor color theme |
|
|
132
|
+
| `uploadFile` | `(file: File) => Promise<string>` | Data URL converter | File upload handler |
|
|
133
|
+
| `initialContent` | `PartialBlock[]` | `undefined` | Initial editor content |
|
|
134
|
+
| `editable` | `boolean` | `true` | Whether editor is editable |
|
|
135
|
+
| `sideMenu` | `boolean` | `true` | Show side menu (drag handle, plus button) |
|
|
136
|
+
| `slashMenu` | `boolean` | `true` | Enable slash commands menu |
|
|
137
|
+
| `formattingToolbar` | `boolean` | `true` | Show formatting toolbar |
|
|
138
|
+
| `linkToolbar` | `boolean` | `true` | Show link toolbar |
|
|
139
|
+
| `filePanel` | `boolean` | `true` | Show file panel |
|
|
140
|
+
| `tableHandles` | `boolean` | `true` | Show table manipulation handles |
|
|
141
|
+
|
|
142
|
+
### `IxoEditor` Component
|
|
143
|
+
|
|
144
|
+
The main editor component. Available in both UI versions with identical APIs.
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
<IxoEditor
|
|
148
|
+
editor={editor}
|
|
149
|
+
className="my-custom-class"
|
|
150
|
+
onChange={() => {}}
|
|
151
|
+
onSelectionChange={() => {}}
|
|
152
|
+
/>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
#### Props
|
|
156
|
+
|
|
157
|
+
| Prop | Type | Description |
|
|
158
|
+
| ------------------- | ------------------------------ | ----------------------------------------- |
|
|
159
|
+
| `editor` | `BlockNoteEditor \| undefined` | Editor instance from `useCreateIxoEditor` |
|
|
160
|
+
| `className` | `string` | Additional CSS classes |
|
|
161
|
+
| `onChange` | `() => void` | Callback when content changes |
|
|
162
|
+
| `onSelectionChange` | `() => void` | Callback when selection changes |
|
|
163
|
+
| `children` | `React.ReactNode` | Custom child components |
|
|
164
|
+
|
|
165
|
+
## Advanced Usage
|
|
166
|
+
|
|
167
|
+
### Custom File Upload
|
|
168
|
+
|
|
169
|
+
```tsx
|
|
170
|
+
const editor = useCreateIxoEditor({
|
|
171
|
+
uploadFile: async (file: File) => {
|
|
172
|
+
const formData = new FormData();
|
|
173
|
+
formData.append('file', file);
|
|
174
|
+
|
|
175
|
+
const response = await fetch('/api/upload', {
|
|
176
|
+
method: 'POST',
|
|
177
|
+
body: formData,
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const { url } = await response.json();
|
|
181
|
+
return url;
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Collaborative Editing
|
|
187
|
+
|
|
188
|
+
For real-time collaborative editing, use the `useCreateCollaborativeIxoEditor` hook with Matrix protocol:
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
import { useCreateCollaborativeIxoEditor, IxoEditor } from '@ixo/editor/shadcn';
|
|
192
|
+
|
|
193
|
+
function CollaborativeEditor() {
|
|
194
|
+
const { editor, connectionStatus } = useCreateCollaborativeIxoEditor({
|
|
195
|
+
theme: 'light',
|
|
196
|
+
user: {
|
|
197
|
+
id: 'user-123',
|
|
198
|
+
name: 'John Doe',
|
|
199
|
+
color: '#FF5733',
|
|
200
|
+
accessToken: 'your-matrix-access-token',
|
|
201
|
+
address: 'your-user-address',
|
|
202
|
+
},
|
|
203
|
+
matrixClient: matrixClient,
|
|
204
|
+
roomId: '!roomId:matrix.org',
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
<div>
|
|
209
|
+
<div>Connection: {connectionStatus}</div>
|
|
210
|
+
<IxoEditor editor={editor} />
|
|
211
|
+
</div>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Dark Theme
|
|
217
|
+
|
|
218
|
+
```tsx
|
|
219
|
+
const editor = useCreateIxoEditor({
|
|
220
|
+
theme: 'dark',
|
|
221
|
+
});
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Read-Only Mode
|
|
225
|
+
|
|
226
|
+
```tsx
|
|
227
|
+
const editor = useCreateIxoEditor({
|
|
228
|
+
editable: false,
|
|
229
|
+
sideMenu: false,
|
|
230
|
+
slashMenu: false,
|
|
231
|
+
formattingToolbar: false,
|
|
232
|
+
});
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Custom Blocks
|
|
236
|
+
|
|
237
|
+
The IXO Editor includes custom blocks for working with IXO ecosystem data, available in both UI versions:
|
|
238
|
+
|
|
239
|
+
### List Block
|
|
240
|
+
|
|
241
|
+
The List block displays dynamic data from DID and fragment identifiers, perfect for displaying data from your GraphQL API.
|
|
242
|
+
|
|
243
|
+
### Overview Block
|
|
244
|
+
|
|
245
|
+
The Overview block provides a comprehensive view of entity data from DID identifiers.
|
|
246
|
+
|
|
247
|
+
#### Usage
|
|
248
|
+
|
|
249
|
+
Both blocks can be inserted using the slash menu:
|
|
250
|
+
|
|
251
|
+
**List Block:**
|
|
252
|
+
|
|
253
|
+
1. Type `/list` in the editor
|
|
254
|
+
2. Or type `/` and search for "List", "data", or "dynamic"
|
|
255
|
+
3. Configure the DID and fragment identifier in the settings
|
|
256
|
+
|
|
257
|
+
**Overview Block:**
|
|
258
|
+
|
|
259
|
+
1. Type `/overview` in the editor
|
|
260
|
+
2. Or type `/` and search for "Overview", "overview-block", or "data-overview"
|
|
261
|
+
3. Configure the DID in the settings
|
|
262
|
+
|
|
263
|
+
#### Programmatic Usage
|
|
264
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
// Insert a list block programmatically
|
|
267
|
+
editor.insertBlocks(
|
|
268
|
+
[
|
|
269
|
+
{
|
|
270
|
+
type: 'list',
|
|
271
|
+
props: {
|
|
272
|
+
title: 'My Data List',
|
|
273
|
+
did: 'did:ixo:entity123',
|
|
274
|
+
fragmentIdentifier: 'claims-data',
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
editor.getTextCursorPosition().block,
|
|
279
|
+
'after'
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
// Insert an overview block programmatically
|
|
283
|
+
editor.insertBlocks(
|
|
284
|
+
[
|
|
285
|
+
{
|
|
286
|
+
type: 'overview',
|
|
287
|
+
props: {
|
|
288
|
+
did: 'did:ixo:entity123',
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
],
|
|
292
|
+
editor.getTextCursorPosition().block,
|
|
293
|
+
'after'
|
|
294
|
+
);
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
## UI Library Comparison
|
|
298
|
+
|
|
299
|
+
| Feature | Shadcn UI | Mantine UI |
|
|
300
|
+
| ----------------- | -------------------- | --------------------- |
|
|
301
|
+
| **Bundle Size** | ~46KB CSS | ~173KB CSS |
|
|
302
|
+
| **Custom Blocks** | Full-featured | Minimal (expandable) |
|
|
303
|
+
| **Theming** | Tailwind-based | CSS-in-JS |
|
|
304
|
+
| **Dependencies** | Radix UI primitives | Mantine ecosystem |
|
|
305
|
+
| **Customization** | High (CSS variables) | High (theme provider) |
|
|
306
|
+
|
|
307
|
+
### When to Choose Shadcn UI
|
|
308
|
+
|
|
309
|
+
- ✅ You're already using Tailwind CSS
|
|
310
|
+
- ✅ You prefer smaller bundle sizes
|
|
311
|
+
- ✅ You want the full-featured custom blocks
|
|
312
|
+
- ✅ You like CSS variable-based theming
|
|
313
|
+
|
|
314
|
+
### When to Choose Mantine UI
|
|
315
|
+
|
|
316
|
+
- ✅ You're already using Mantine in your app
|
|
317
|
+
- ✅ You prefer component-based theming
|
|
318
|
+
- ✅ You want consistent Mantine design language
|
|
319
|
+
- ✅ You plan to enhance the minimal blocks with Mantine components
|
|
320
|
+
|
|
321
|
+
## Development
|
|
322
|
+
|
|
323
|
+
### Project Structure
|
|
324
|
+
|
|
325
|
+
```
|
|
326
|
+
ixo-editor/
|
|
327
|
+
├── src/
|
|
328
|
+
│ ├── core/ # Shared infrastructure
|
|
329
|
+
│ │ ├── types.ts # Shared types
|
|
330
|
+
│ │ ├── hooks/ # Matrix provider
|
|
331
|
+
│ │ └── lib/ # GraphQL client & utilities
|
|
332
|
+
│ ├── shadcn/ # Shadcn UI implementation
|
|
333
|
+
│ │ ├── IxoEditor.tsx
|
|
334
|
+
│ │ ├── blocks/ # Full-featured custom blocks
|
|
335
|
+
│ │ ├── components/ # Shadcn UI components
|
|
336
|
+
│ │ ├── hooks/ # Editor hooks
|
|
337
|
+
│ │ └── index.ts # Shadcn exports
|
|
338
|
+
│ ├── mantine/ # Mantine UI implementation
|
|
339
|
+
│ │ ├── IxoEditor.tsx
|
|
340
|
+
│ │ ├── blocks/ # Minimal custom blocks
|
|
341
|
+
│ │ ├── hooks/ # Editor hooks
|
|
342
|
+
│ │ └── index.ts # Mantine exports
|
|
343
|
+
│ ├── styles/ # Source CSS
|
|
344
|
+
│ │ └── ixo-editor.css
|
|
345
|
+
│ └── index.ts # Main entry (defaults to shadcn)
|
|
346
|
+
├── fonts/ # Inter font files
|
|
347
|
+
├── dist/ # Built JavaScript
|
|
348
|
+
│ ├── index.js # Main bundle
|
|
349
|
+
│ ├── shadcn/ # Shadcn bundle
|
|
350
|
+
│ └── mantine/ # Mantine bundle
|
|
351
|
+
├── style*.css # CSS bundles
|
|
352
|
+
└── package.json
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Building the Package
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
# Install dependencies
|
|
359
|
+
pnpm install
|
|
360
|
+
|
|
361
|
+
# Build the package (creates all bundles)
|
|
362
|
+
pnpm build
|
|
363
|
+
|
|
364
|
+
# Watch for changes during development
|
|
365
|
+
pnpm run dev
|
|
366
|
+
|
|
367
|
+
# Type checking
|
|
368
|
+
pnpm run type-check
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
## Requirements
|
|
372
|
+
|
|
373
|
+
- React 18.0.0 or higher
|
|
374
|
+
- React DOM 18.0.0 or higher
|
|
375
|
+
- Modern browser with ES2020 support
|
|
376
|
+
- For collaborative editing: Matrix server access
|
|
377
|
+
|
|
378
|
+
### Additional Requirements by UI Library
|
|
379
|
+
|
|
380
|
+
**For Mantine version:**
|
|
381
|
+
|
|
382
|
+
- `@mantine/core` ^8.0.0 (peer dependency)
|
|
383
|
+
- `@mantine/hooks` ^8.0.0 (peer dependency)
|
|
384
|
+
|
|
385
|
+
**For Shadcn version:**
|
|
386
|
+
|
|
387
|
+
- Works with existing Tailwind CSS setup
|
|
388
|
+
- No additional peer dependencies
|
|
389
|
+
|
|
390
|
+
## Migration Guide
|
|
391
|
+
|
|
392
|
+
### From v1.x to v2.x (Multi-UI)
|
|
393
|
+
|
|
394
|
+
**Before (v1.x):**
|
|
395
|
+
|
|
396
|
+
```tsx
|
|
397
|
+
import { IxoEditor } from '@ixo/editor';
|
|
398
|
+
import '@blocknote/shadcn/style.css';
|
|
399
|
+
import '@ixo/editor/style.css';
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**After (v2.x) - Recommended:**
|
|
403
|
+
|
|
404
|
+
```tsx
|
|
405
|
+
// Explicit shadcn version with complete CSS bundle
|
|
406
|
+
import { IxoEditor } from '@ixo/editor/shadcn';
|
|
407
|
+
import '@ixo/editor/style-shadcn.css'; // Single import!
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
**After (v2.x) - Backward compatible:**
|
|
411
|
+
|
|
412
|
+
```tsx
|
|
413
|
+
// Still works! (defaults to shadcn)
|
|
414
|
+
import { IxoEditor } from '@ixo/editor';
|
|
415
|
+
import '@ixo/editor/style.css'; // Now includes all dependencies
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
## License
|
|
419
|
+
|
|
420
|
+
MIT © IXO Team
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
## Internal Notes
|
|
425
|
+
|
|
426
|
+
This package is maintained by the IXO development team. For questions or issues, please contact the team directly through internal channels.
|
|
427
|
+
|
|
428
|
+
### Version Management
|
|
429
|
+
|
|
430
|
+
Follow semantic versioning:
|
|
431
|
+
|
|
432
|
+
- Patch releases (0.0.x): Bug fixes and minor updates
|
|
433
|
+
- Minor releases (0.x.0): New features that are backward compatible
|
|
434
|
+
- Major releases (x.0.0): Breaking changes (like the multi-UI restructure)
|
|
435
|
+
|
|
436
|
+
### Contributing
|
|
437
|
+
|
|
438
|
+
This is an internal package. All contributions should go through the standard IXO development workflow and review process.
|