@fileverse-dev/ddoc 2.1.4 → 2.1.5-patch-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -92
- package/dist/index.es.js +33187 -31477
- package/dist/package/components/editor-bubble-menu/props.d.ts +1 -0
- package/dist/package/components/editor-bubble-menu/types.d.ts +1 -0
- package/dist/package/components/editor-toolbar.d.ts +2 -1
- package/dist/package/components/editor-utils.d.ts +2 -1
- package/dist/package/components/inline-comment/context/types.d.ts +8 -1
- package/dist/package/components/link-preview-card.d.ts +12 -0
- package/dist/package/components/presentation-mode/presentation-mode.d.ts +2 -1
- package/dist/package/components/presentation-mode/preview-panel.d.ts +1 -6
- package/dist/package/extensions/action-button/action-button-node-view.d.ts +1 -1
- package/dist/package/extensions/default-extension.d.ts +1 -1
- package/dist/package/extensions/link-preview/link-preview.d.ts +7 -0
- package/dist/package/extensions/resizable-media/resizable-media-menu-util.d.ts +4 -1
- package/dist/package/hooks/use-headless-editor.d.ts +1 -0
- package/dist/package/types.d.ts +4 -0
- package/dist/package/use-ddoc-editor.d.ts +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# Ddoc Editor
|
2
2
|
|
3
|
-
[ddocs.new](http://ddocs.new/) is your onchain, privacy-first alternative to G
|
3
|
+
[ddocs.new](http://ddocs.new/) is your onchain, privacy-first alternative to G\**gle D*cs: peer-to-peer, end-to-end encrypted, and decentralized. It enables secure, real-time, and async collaboration without compromising user privacy.
|
4
4
|
|
5
5
|
<img width="4410" alt="github_banner_final@3x" src="https://github.com/user-attachments/assets/c6ee706d-979d-41b6-9f73-d29fbabb5152" />
|
6
6
|
|
7
|
-
|
8
7
|
This repository contains:
|
9
|
-
|
8
|
+
|
9
|
+
- `/package` – The core package code.
|
10
10
|
- Example & demo source code to showcase dDocs functionalities.
|
11
11
|
|
12
12
|
## Usage
|
@@ -16,78 +16,112 @@ This repository contains:
|
|
16
16
|
To use dDocs, ensure your project is set up with Tailwind CSS and have a Tailwind configuration file.
|
17
17
|
|
18
18
|
### Install & import
|
19
|
+
|
19
20
|
Add the following imports :
|
21
|
+
|
20
22
|
```javascript
|
21
|
-
import { DdocEditor } from '@fileverse-dev/ddoc'
|
22
|
-
import '@fileverse-dev/ddoc/styles' // in App.jsx/App.tsx
|
23
|
+
import { DdocEditor } from '@fileverse-dev/ddoc';
|
24
|
+
import '@fileverse-dev/ddoc/styles'; // in App.jsx/App.tsx
|
23
25
|
```
|
24
26
|
|
25
|
-
|
26
27
|
### Update Tailwind Config
|
28
|
+
|
27
29
|
In your tailwind config, add this line to content array :
|
28
30
|
|
29
31
|
`@fileverse-dev/ddoc/dist/index.es.js`
|
30
32
|
|
31
33
|
You should now be set to use dDocs!
|
32
34
|
|
33
|
-
|
34
35
|
# dDocProps Interface
|
35
36
|
|
36
37
|
The `DdocProps` interface is a TypeScript interface that defines the properties for a page-related component. It includes properties for handling preview mode, managing publishing data, and optionally storing metadata and content associated with the page.
|
37
38
|
|
38
|
-
##
|
39
|
-
|
40
|
-
| Property
|
41
|
-
|
|
42
|
-
| `
|
43
|
-
| `
|
44
|
-
| `
|
45
|
-
| `
|
46
|
-
| `
|
47
|
-
| `
|
48
|
-
| `
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
|
53
|
-
|
|
54
|
-
| `
|
55
|
-
| `
|
56
|
-
| `
|
57
|
-
| `
|
58
|
-
| `
|
59
|
-
| `
|
60
|
-
| `
|
61
|
-
| `
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
|
66
|
-
|
|
67
|
-
| `zoomLevel`
|
68
|
-
| `setZoomLevel`
|
69
|
-
| `isNavbarVisible`
|
70
|
-
| `setIsNavbarVisible`
|
71
|
-
| `renderNavbar`
|
72
|
-
| `
|
73
|
-
| `isPresentationMode`
|
74
|
-
| `setIsPresentationMode`
|
75
|
-
| `
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
|
89
|
-
|
|
90
|
-
| `
|
39
|
+
## Core Props
|
40
|
+
|
41
|
+
| Property | Type | Description |
|
42
|
+
| ------------------------ | --------------------------------------------- | ----------------------------------------------- |
|
43
|
+
| `initialContent` | `JSONContent` | Initial content of the editor |
|
44
|
+
| `onChange` | `(changes: JSONContent, chunk?: any) => void` | Callback triggered on editor content changes |
|
45
|
+
| `ref` | `React.RefObject` | Reference to access editor instance |
|
46
|
+
| `isPreviewMode` | `boolean` | Controls if editor is in preview/read-only mode |
|
47
|
+
| `editorCanvasClassNames` | `string` | Additional CSS classes for editor canvas |
|
48
|
+
| `ignoreCorruptedData` | `boolean` | Whether to ignore corrupted data during loading |
|
49
|
+
| `onInvalidContentError` | `(error: any) => void` | Callback for handling invalid content errors |
|
50
|
+
|
51
|
+
## Collaboration Props
|
52
|
+
|
53
|
+
| Property | Type | Description |
|
54
|
+
| ---------------------- | --------------------------------------------- | ------------------------------------------------------------------------- |
|
55
|
+
| `enableCollaboration` | `boolean` | Enables real-time collaboration features |
|
56
|
+
| `collaborationId` | `string` | Unique ID for collaboration session (required when collaboration enabled) |
|
57
|
+
| `username` | `string` | User's display name for collaboration |
|
58
|
+
| `setUsername` | `(username: string) => void` | Function to update username |
|
59
|
+
| `walletAddress` | `string` | User's wallet address |
|
60
|
+
| `onCollaboratorChange` | `(collaborators?: IDocCollabUsers[]) => void` | Callback when collaborators change |
|
61
|
+
| `enableIndexeddbSync` | `boolean` | Enables IndexedDB sync for offline support |
|
62
|
+
| `ddocId` | `string` | Unique document ID (required for IndexedDB sync) |
|
63
|
+
|
64
|
+
## UI/UX Props
|
65
|
+
|
66
|
+
| Property | Type | Description |
|
67
|
+
| ----------------------- | ----------------------------------------- | ------------------------------------ |
|
68
|
+
| `zoomLevel` | `string` | Current zoom level of the editor |
|
69
|
+
| `setZoomLevel` | `React.Dispatch<SetStateAction<string>>` | Function to update zoom level |
|
70
|
+
| `isNavbarVisible` | `boolean` | Controls navbar visibility |
|
71
|
+
| `setIsNavbarVisible` | `React.Dispatch<SetStateAction<boolean>>` | Function to toggle navbar visibility |
|
72
|
+
| `renderNavbar` | `() => JSX.Element` | Custom navbar renderer |
|
73
|
+
| `renderThemeToggle` | `() => JSX.Element` | Custom theme toggle renderer |
|
74
|
+
| `isPresentationMode` | `boolean` | Controls presentation mode |
|
75
|
+
| `setIsPresentationMode` | `React.Dispatch<SetStateAction<boolean>>` | Function to toggle presentation mode |
|
76
|
+
| `sharedSlidesLink` | `string` | Link for shared presentation slides |
|
77
|
+
|
78
|
+
## Comments & Collaboration Props
|
79
|
+
|
80
|
+
| Property | Type | Description |
|
81
|
+
| ---------------------- | --------------------------------------- | ---------------------------------- |
|
82
|
+
| `initialComments` | `IComment[]` | Initial comments to display |
|
83
|
+
| `setInitialComments` | `(comments: IComment[]) => void` | Function to update comments |
|
84
|
+
| `onCommentReply` | `(id: string, reply: IComment) => void` | Callback for comment replies |
|
85
|
+
| `onNewComment` | `(comment: IComment) => void` | Callback for new comments |
|
86
|
+
| `commentDrawerOpen` | `boolean` | Controls comment drawer visibility |
|
87
|
+
| `setCommentDrawerOpen` | `(isOpen: boolean) => void` | Function to toggle comment drawer |
|
88
|
+
| `onResolveComment` | `(commentId: string) => void` | Callback when resolving comments |
|
89
|
+
| `onUnresolveComment` | `(commentId: string) => void` | Callback when unresolving comments |
|
90
|
+
| `onDeleteComment` | `(commentId: string) => void` | Callback when deleting comments |
|
91
|
+
| `disableInlineComment` | `boolean` | Disables inline commenting feature |
|
92
|
+
|
93
|
+
## Authentication Props
|
94
|
+
|
95
|
+
| Property | Type | Description |
|
96
|
+
| -------------------- | ------------------------------------- | ----------------------------------- |
|
97
|
+
| `isConnected` | `boolean` | User connection status |
|
98
|
+
| `isLoading` | `boolean` | Authentication loading state |
|
99
|
+
| `connectViaUsername` | `(username: string) => Promise<void>` | Username-based authentication |
|
100
|
+
| `connectViaWallet` | `() => Promise<void>` | Wallet-based authentication |
|
101
|
+
| `isDDocOwner` | `boolean` | Indicates if user owns the document |
|
102
|
+
|
103
|
+
## Utility Props
|
104
|
+
|
105
|
+
| Property | Type | Description |
|
106
|
+
| ---------------------- | ---------------------------------------- | ---------------------------- |
|
107
|
+
| `setCharacterCount` | `React.Dispatch<SetStateAction<number>>` | Updates character count |
|
108
|
+
| `setWordCount` | `React.Dispatch<SetStateAction<number>>` | Updates word count |
|
109
|
+
| `ensResolutionUrl` | `string` | URL for ENS name resolution |
|
110
|
+
| `secureImageUploadUrl` | `string` | URL for secure image uploads |
|
111
|
+
| `onError` | `(error: string) => void` | General error handler |
|
112
|
+
| `onInlineComment` | `() => void` | Callback for inline comments |
|
113
|
+
| `onMarkdownExport` | `() => void` | Callback for markdown export |
|
114
|
+
| `onMarkdownImport` | `() => void` | Callback for markdown import |
|
115
|
+
| `onSlidesShare` | `() => void` | Callback for slides sharing |
|
116
|
+
| `onComment` | `() => void` | General comment callback |
|
117
|
+
|
118
|
+
## Pro Features
|
119
|
+
|
120
|
+
| Property | Type | Description |
|
121
|
+
| --------------- | ---------------------------------------------- | ------------------------------------- |
|
122
|
+
| `showTOC` | `boolean` | Controls table of contents visibility |
|
123
|
+
| `setShowTOC` | `React.Dispatch<SetStateAction<boolean>>` | Function to toggle TOC |
|
124
|
+
| `proExtensions` | `{ TableOfContents: any, [key: string]: any }` | Pro feature extensions |
|
91
125
|
|
92
126
|
### Steps to run this example locally
|
93
127
|
|
@@ -111,35 +145,3 @@ proExtensions={{
|
|
111
145
|
TableOfContents
|
112
146
|
}}
|
113
147
|
```
|
114
|
-
|
115
|
-
### Comment-related Props
|
116
|
-
|
117
|
-
| Prop | Type | Description |
|
118
|
-
| ---------------------- | --------------------------------------- | -------------------------------------------------------- |
|
119
|
-
| `initialComments` | `IComment[]` | Array of initial comments to populate the editor |
|
120
|
-
| `onCommentReply` | `(id: string, reply: IComment) => void` | Callback function when a reply is added to a comment |
|
121
|
-
| `onNewComment` | `(comment: IComment) => void` | Callback function when a new comment is created |
|
122
|
-
| `setInitialComments` | `(comments: IComment[]) => void` | Function to update the initial comments array |
|
123
|
-
| `onResolveComment` | `(commentId: string) => void` | Callback function when a comment is marked as resolved |
|
124
|
-
| `onUnresolveComment` | `(commentId: string) => void` | Callback function when a comment is marked as unresolved |
|
125
|
-
| `onDeleteComment` | `(commentId: string) => void` | Callback function when a comment is deleted |
|
126
|
-
| `commentDrawerOpen` | `boolean` | Controls the visibility of the comment drawer |
|
127
|
-
| `setCommentDrawerOpen` | `(isOpen: boolean) => void` | Function to toggle the comment drawer |
|
128
|
-
|
129
|
-
### Table of Contents Props
|
130
|
-
|
131
|
-
| Prop | Type | Description |
|
132
|
-
| --------------- | ------------------------------------------------------- | --------------------------------------------------- |
|
133
|
-
| `showTOC` | `boolean` | Controls the visibility of the table of contents |
|
134
|
-
| `setShowTOC` | `(show: boolean) => void` | Function to toggle the table of contents visibility |
|
135
|
-
| `proExtensions` | `{ TableOfContents: any, getHierarchicalIndexes: any }` | Extensions for table of contents functionality |
|
136
|
-
|
137
|
-
### Authentication Props
|
138
|
-
|
139
|
-
| Prop | Type | Description |
|
140
|
-
| -------------------- | ------------------------------------- | --------------------------------------------------- |
|
141
|
-
| `isConnected` | `boolean` | Indicates if the user is connected |
|
142
|
-
| `connectViaWallet` | `() => Promise<void>` | Function to handle wallet-based authentication |
|
143
|
-
| `isLoading` | `boolean` | Indicates if authentication is in progress |
|
144
|
-
| `connectViaUsername` | `(username: string) => Promise<void>` | Function to handle username-based authentication |
|
145
|
-
| `isDDocOwner` | `boolean` | Indicates if the current user is the document owner |
|