tiptop-editor 2.0.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 +256 -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/components/editor/createDefaultExtensions.d.ts +2 -1
- package/dist/extensions/comment/CommentMark.d.ts +23 -0
- package/dist/extensions/comment/NodeCommentExtension.d.ts +17 -0
- package/dist/helpers.d.ts +2 -1
- package/dist/index.d.ts +6 -0
- package/dist/tiptop-editor.css +1 -1
- package/dist/tiptop-editor.es.js +12447 -12341
- package/dist/tiptop-editor.umd.js +20 -21
- package/dist/types.d.ts +54 -0
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -18,6 +18,12 @@ export type TiptopEditorOptions = Omit<Partial<UseEditorOptions & {
|
|
|
18
18
|
*/
|
|
19
19
|
imgUploadResponseKey?: ImageUploadResponseResolver;
|
|
20
20
|
/**
|
|
21
|
+
* Custom HTTP headers to include in the image upload request.
|
|
22
|
+
* Useful for passing authorization tokens or other API headers.
|
|
23
|
+
* @default undefined
|
|
24
|
+
*/
|
|
25
|
+
imgUploadHeaders?: Record<string, string>;
|
|
26
|
+
/**
|
|
21
27
|
* Disables the default Card wrapper and removes the editor's built-in padding.
|
|
22
28
|
* Use this when you want to embed the editor inside your own layout container.
|
|
23
29
|
* @default false
|
|
@@ -29,6 +35,15 @@ export type TiptopEditorOptions = Omit<Partial<UseEditorOptions & {
|
|
|
29
35
|
*/
|
|
30
36
|
showDragHandle?: boolean;
|
|
31
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
|
+
/**
|
|
32
47
|
* Additional Tiptap extensions to append after the built-in editor set.
|
|
33
48
|
* Use this to add feature-specific extensions like AI commands or collaboration.
|
|
34
49
|
* @default undefined
|
|
@@ -196,6 +211,44 @@ export interface KeyDownRef {
|
|
|
196
211
|
event: KeyboardEvent;
|
|
197
212
|
}) => boolean;
|
|
198
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
|
+
}
|
|
199
252
|
export interface ImageUploaderExtensionOptions {
|
|
200
253
|
/**
|
|
201
254
|
* The url of the server where the file should be uploaded.
|
|
@@ -213,6 +266,7 @@ export interface ImageUploaderExtensionOptions {
|
|
|
213
266
|
imgUploadResponseKey?: ImageUploadResponseResolver;
|
|
214
267
|
allowedMimeTypes?: string[];
|
|
215
268
|
maxFileSize: number;
|
|
269
|
+
imgUploadHeaders?: Record<string, string>;
|
|
216
270
|
}
|
|
217
271
|
export interface ImageUploaderExtensionStorage {
|
|
218
272
|
uploadImageFromFile: (editor: Editor, file: File, id: string, updateExisting?: boolean, pos?: number) => void;
|