tiptop-editor 2.1.0 → 2.2.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 +223 -0
- package/dist/components/comment/CommentButton.d.ts +7 -0
- package/dist/components/comment/CommentSelectionMenu.d.ts +10 -0
- package/dist/components/comment/CommentsContext.d.ts +11 -0
- package/dist/components/comment/context.d.ts +2 -0
- package/dist/components/comment/useCommentActions.d.ts +13 -0
- package/dist/components/comment/useComments.d.ts +7 -0
- package/dist/components/editor/TiptopEditor.stories.d.ts +1 -0
- package/dist/extensions/comment/CommentMark.d.ts +23 -0
- package/dist/extensions/comment/NodeCommentExtension.d.ts +17 -0
- package/dist/index.d.ts +6 -0
- package/dist/tiptop-editor.css +1 -1
- package/dist/tiptop-editor.es.js +4627 -4363
- package/dist/tiptop-editor.umd.js +19 -20
- package/dist/types.d.ts +47 -0
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -35,6 +35,15 @@ export type TiptopEditorOptions = Omit<Partial<UseEditorOptions & {
|
|
|
35
35
|
*/
|
|
36
36
|
showDragHandle?: boolean;
|
|
37
37
|
/**
|
|
38
|
+
* Enables the comment system. When `true`:
|
|
39
|
+
* - The `CommentMark` and `NodeCommentExtension` extensions are added automatically.
|
|
40
|
+
* - A `CommentSelectionMenu` bubble menu is rendered that appears on text selection
|
|
41
|
+
* when the editor is in view mode (`editable: false`).
|
|
42
|
+
* - Wrap the editor with `CommentsProvider` and add your own comment drawer using `useComments()` and `useCommentActions()`.
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
showCommentMenu?: boolean;
|
|
46
|
+
/**
|
|
38
47
|
* Additional Tiptap extensions to append after the built-in editor set.
|
|
39
48
|
* Use this to add feature-specific extensions like AI commands or collaboration.
|
|
40
49
|
* @default undefined
|
|
@@ -202,6 +211,44 @@ export interface KeyDownRef {
|
|
|
202
211
|
event: KeyboardEvent;
|
|
203
212
|
}) => boolean;
|
|
204
213
|
}
|
|
214
|
+
export interface TiptopCommentReply {
|
|
215
|
+
id: string;
|
|
216
|
+
content: string;
|
|
217
|
+
author?: string;
|
|
218
|
+
createdAt: Date;
|
|
219
|
+
}
|
|
220
|
+
export interface TiptopComment {
|
|
221
|
+
id: string;
|
|
222
|
+
/** 'inline' — applied to a text range via a mark. 'node' — applied to a whole block node. */
|
|
223
|
+
type: 'inline' | 'node';
|
|
224
|
+
content: string;
|
|
225
|
+
author?: string;
|
|
226
|
+
createdAt: Date;
|
|
227
|
+
replies: TiptopCommentReply[];
|
|
228
|
+
resolved: boolean;
|
|
229
|
+
}
|
|
230
|
+
export type PendingComment = {
|
|
231
|
+
id: string;
|
|
232
|
+
type: 'inline';
|
|
233
|
+
from: number;
|
|
234
|
+
to: number;
|
|
235
|
+
} | {
|
|
236
|
+
id: string;
|
|
237
|
+
type: 'node';
|
|
238
|
+
nodePos: number;
|
|
239
|
+
};
|
|
240
|
+
export interface CommentsContextValue {
|
|
241
|
+
comments: TiptopComment[];
|
|
242
|
+
activeCommentId: string | null;
|
|
243
|
+
pendingComment: PendingComment | null;
|
|
244
|
+
addComment: (id: string, type: 'inline' | 'node', content: string, author?: string) => void;
|
|
245
|
+
removeComment: (id: string) => void;
|
|
246
|
+
resolveComment: (id: string) => void;
|
|
247
|
+
replyToComment: (commentId: string, content: string, author?: string) => void;
|
|
248
|
+
setActiveCommentId: (id: string | null) => void;
|
|
249
|
+
setPendingComment: (comment: PendingComment | null) => void;
|
|
250
|
+
getComment: (id: string) => TiptopComment | undefined;
|
|
251
|
+
}
|
|
205
252
|
export interface ImageUploaderExtensionOptions {
|
|
206
253
|
/**
|
|
207
254
|
* The url of the server where the file should be uploaded.
|