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/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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiptop-editor",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "Notion-like editor built with Tiptap v3 and HeroUI",
5
5
  "type": "module",
6
6
  "main": "./dist/tiptop-editor.umd.js",