@univerjs/sheets-thread-comment 0.5.3 → 0.5.4

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.
@@ -0,0 +1,247 @@
1
+ import { IEventBase, RichTextValue, FEventName } from '@univerjs/core';
2
+ import { FWorkbook, FWorksheet } from '@univerjs/sheets/facade';
3
+ import { FTheadCommentItem, FThreadComment } from './f-thread-comment';
4
+ interface ICommentEventMixin {
5
+ /**
6
+ * Event fired after comment added
7
+ * @see {@link ISheetCommentAddEvent}
8
+ * @example
9
+ * ```ts
10
+ * univerAPI.addEventListener(CommentEvent.CommentAdded, (event) => {
11
+ * const { comment, workbook, worksheet, row, col } = event;
12
+ * console.log(event);
13
+ * });
14
+ * ```
15
+ */
16
+ readonly CommentAdded: 'CommentAdded';
17
+ /**
18
+ * Event fired before comment added
19
+ * @see {@link IBeforeSheetCommentAddEvent}
20
+ * @example
21
+ * ```ts
22
+ * univerAPI.addEventListener(CommentEvent.BeforeCommentAdd, (event) => {
23
+ * const { comment, workbook, worksheet, row, col } = event;
24
+ * console.log(event);
25
+ * });
26
+ * ```
27
+ */
28
+ readonly BeforeCommentAdd: 'BeforeCommentAdd';
29
+ /**
30
+ * Event fired after comment updated
31
+ * @see {@link ISheetCommentUpdateEvent}
32
+ * @example
33
+ * ```ts
34
+ * univerAPI.addEventListener(CommentEvent.CommentUpdated, (event) => {
35
+ * const { comment, workbook, worksheet, row, col } = event;
36
+ * console.log(event);
37
+ * });
38
+ * ```
39
+ */
40
+ readonly CommentUpdated: 'CommentUpdated';
41
+ /**
42
+ * Event fired before comment update
43
+ * @see {@link IBeforeSheetCommentUpdateEvent}
44
+ * @example
45
+ * ```ts
46
+ * univerAPI.addEventListener(CommentEvent.BeforeCommentUpdate, (event) => {
47
+ * const { comment, workbook, worksheet, row, col, newContent } = event;
48
+ * console.log(event);
49
+ * });
50
+ * ```
51
+ */
52
+ readonly BeforeCommentUpdate: 'BeforeCommentUpdate';
53
+ /**
54
+ * Event fired after comment deleted
55
+ * @see {@link ISheetCommentDeleteEvent}
56
+ * @example
57
+ * ```ts
58
+ * univerAPI.addEventListener(CommentEvent.CommentDeleted, (event) => {
59
+ * const { commentId, workbook, worksheet } = event;
60
+ * console.log(event);
61
+ * });
62
+ * ```
63
+ */
64
+ readonly CommentDeleted: 'CommentDeleted';
65
+ /**
66
+ * Event fired before comment delete
67
+ * @see {@link IBeforeSheetCommentDeleteEvent}
68
+ * @example
69
+ * ```ts
70
+ * univerAPI.addEventListener(CommentEvent.BeforeCommentDeleted, (event) => {
71
+ * const { commentId, workbook, worksheet } = event;
72
+ * console.log(event);
73
+ * });
74
+ * ```
75
+ */
76
+ readonly BeforeCommentDeleted: 'BeforeCommentDeleted';
77
+ /**
78
+ * Event fired after comment resolve
79
+ * @see {@link ISheetCommentResolveEvent}
80
+ * @example
81
+ * ```ts
82
+ * univerAPI.addEventListener(CommentEvent.CommentResolved, (event) => {
83
+ * const { comment, row, col, resolved, workbook, worksheet } = event;
84
+ * console.log(event);
85
+ * });
86
+ * ```
87
+ */
88
+ readonly CommentResolved: 'CommentResolved';
89
+ /**
90
+ * Event fired before comment resolve
91
+ * @see {@link ISheetCommentResolveEvent}
92
+ * @example
93
+ * ```ts
94
+ * univerAPI.addEventListener(CommentEvent.BeforeCommentResolve, (event) => {
95
+ * const { comment, row, col, resolved, workbook, worksheet } = event;
96
+ * console.log(event);
97
+ * });
98
+ * ```
99
+ */
100
+ readonly BeforeCommentResolve: 'BeforeCommentResolve';
101
+ }
102
+ export declare class FCommentEvent extends FEventName {
103
+ get CommentAdded(): 'CommentAdded';
104
+ get BeforeCommentAdd(): 'BeforeCommentAdd';
105
+ get CommentUpdated(): 'CommentUpdated';
106
+ get BeforeCommentUpdate(): 'BeforeCommentUpdate';
107
+ get CommentDeleted(): 'CommentDeleted';
108
+ get BeforeCommentDeleted(): 'BeforeCommentDeleted';
109
+ get CommentResolved(): 'CommentResolved';
110
+ get BeforeCommentResolve(): 'BeforeCommentResolve';
111
+ }
112
+ /**
113
+ * Event interface triggered after a comment is added to a sheet
114
+ * @interface ISheetCommentAddEvent
115
+ * @augments {IEventBase}
116
+ */
117
+ export interface ISheetCommentAddEvent extends IEventBase {
118
+ /** The workbook instance */
119
+ workbook: FWorkbook;
120
+ /** The worksheet where the comment is added */
121
+ worksheet: FWorksheet;
122
+ /** Row index of the comment */
123
+ row: number;
124
+ /** Column index of the comment */
125
+ col: number;
126
+ /** The added comment object */
127
+ comment: FThreadComment;
128
+ }
129
+ /**
130
+ * Event interface triggered before a comment is added to a sheet
131
+ * @interface IBeforeSheetCommentAddEvent
132
+ * @augments {IEventBase}
133
+ */
134
+ export interface IBeforeSheetCommentAddEvent extends IEventBase {
135
+ /** The workbook instance */
136
+ workbook: FWorkbook;
137
+ /** The worksheet where the comment will be added */
138
+ worksheet: FWorksheet;
139
+ /** Row index for the new comment */
140
+ row: number;
141
+ /** Column index for the new comment */
142
+ col: number;
143
+ /** The comment item to be added */
144
+ comment: FTheadCommentItem;
145
+ }
146
+ /**
147
+ * Event interface triggered after a comment is updated in a sheet
148
+ * @interface ISheetCommentUpdateEvent
149
+ * @augments {IEventBase}
150
+ */
151
+ export interface ISheetCommentUpdateEvent extends IEventBase {
152
+ /** The workbook instance */
153
+ workbook: FWorkbook;
154
+ /** The worksheet containing the updated comment */
155
+ worksheet: FWorksheet;
156
+ /** Row index of the comment */
157
+ row: number;
158
+ /** Column index of the comment */
159
+ col: number;
160
+ /** The updated comment object */
161
+ comment: FThreadComment;
162
+ }
163
+ /**
164
+ * Event interface triggered before a comment is updated in a sheet
165
+ * @interface IBeforeSheetCommentUpdateEvent
166
+ * @augments {IEventBase}
167
+ */
168
+ export interface IBeforeSheetCommentUpdateEvent extends IEventBase {
169
+ /** The workbook instance */
170
+ workbook: FWorkbook;
171
+ /** The worksheet containing the comment */
172
+ worksheet: FWorksheet;
173
+ /** Row index of the comment */
174
+ row: number;
175
+ /** Column index of the comment */
176
+ col: number;
177
+ /** The current comment object */
178
+ comment: FThreadComment;
179
+ /** The new content to replace the existing comment */
180
+ newContent: RichTextValue;
181
+ }
182
+ /**
183
+ * Event interface triggered before a comment is deleted from a sheet
184
+ * @interface IBeforeSheetCommentDeleteEvent
185
+ * @augments {IEventBase}
186
+ */
187
+ export interface IBeforeSheetCommentDeleteEvent extends IEventBase {
188
+ /** The workbook instance */
189
+ workbook: FWorkbook;
190
+ /** The worksheet containing the comment */
191
+ worksheet: FWorksheet;
192
+ /** Row index of the comment */
193
+ row: number;
194
+ /** Column index of the comment */
195
+ col: number;
196
+ /** The comment to be deleted */
197
+ comment: FThreadComment;
198
+ }
199
+ /**
200
+ * Event interface triggered after a comment is deleted from a sheet
201
+ * @interface ISheetCommentDeleteEvent
202
+ * @augments {IEventBase}
203
+ */
204
+ export interface ISheetCommentDeleteEvent extends IEventBase {
205
+ /** The workbook instance */
206
+ workbook: FWorkbook;
207
+ /** The worksheet that contained the comment */
208
+ worksheet: FWorksheet;
209
+ /** The ID of the deleted comment */
210
+ commentId: string;
211
+ }
212
+ /**
213
+ * Event interface triggered when a comment's resolve status changes
214
+ * @interface ISheetCommentResolveEvent
215
+ * @augments {IEventBase}
216
+ */
217
+ export interface ISheetCommentResolveEvent extends IEventBase {
218
+ /** The workbook instance */
219
+ workbook: FWorkbook;
220
+ /** The worksheet containing the comment */
221
+ worksheet: FWorksheet;
222
+ /** Row index of the comment */
223
+ row: number;
224
+ /** Column index of the comment */
225
+ col: number;
226
+ /** The comment object */
227
+ comment: FThreadComment;
228
+ /** The new resolve status */
229
+ resolved: boolean;
230
+ }
231
+ export interface ISheetCommentEventConfig {
232
+ BeforeCommentAdd: IBeforeSheetCommentAddEvent;
233
+ CommentAdded: ISheetCommentAddEvent;
234
+ BeforeCommentUpdate: IBeforeSheetCommentUpdateEvent;
235
+ CommentUpdated: ISheetCommentUpdateEvent;
236
+ BeforeCommentDeleted: IBeforeSheetCommentDeleteEvent;
237
+ CommentDeleted: ISheetCommentDeleteEvent;
238
+ BeforeCommentResolve: ISheetCommentResolveEvent;
239
+ CommentResolved: ISheetCommentResolveEvent;
240
+ }
241
+ declare module '@univerjs/core' {
242
+ interface FEventName extends ICommentEventMixin {
243
+ }
244
+ interface IEventParamConfig extends ISheetCommentEventConfig {
245
+ }
246
+ }
247
+ export {};
@@ -1,28 +1,40 @@
1
1
  import { IDocumentBody, Nullable } from '@univerjs/core';
2
2
  import { FRange } from '@univerjs/sheets/facade';
3
- import { FThreadComment } from './f-thread-comment';
3
+ import { FTheadCommentBuilder, FThreadComment } from './f-thread-comment';
4
4
  export interface IFRangeCommentMixin {
5
5
  /**
6
6
  * Get the comment of the start cell in the current range.
7
7
  * @returns The comment of the start cell in the current range. If the cell does not have a comment, return `null`.
8
8
  */
9
9
  getComment(): Nullable<FThreadComment>;
10
+ /**
11
+ * Get the comments in the current range.
12
+ * @returns {FThreadComment[]} The comments in the current range.
13
+ */
14
+ getComments(): FThreadComment[];
10
15
  /**
11
16
  * Add a comment to the start cell in the current range.
12
17
  * @param content The content of the comment.
13
18
  * @returns Whether the comment is added successfully.
14
19
  */
15
- addComment(this: FRange, content: IDocumentBody): Promise<boolean>;
20
+ addComment(content: IDocumentBody | FTheadCommentBuilder): Promise<boolean>;
16
21
  /**
17
22
  * Clear the comment of the start cell in the current range.
18
23
  * @returns Whether the comment is cleared successfully.
19
24
  */
20
25
  clearComment(): Promise<boolean>;
26
+ /**
27
+ * Clear all of the comments in the current range.
28
+ * @returns Whether the comments are cleared successfully.
29
+ */
30
+ clearComments(): Promise<boolean>;
21
31
  }
22
32
  export declare class FRangeCommentMixin extends FRange implements IFRangeCommentMixin {
23
33
  getComment(): Nullable<FThreadComment>;
24
- addComment(content: IDocumentBody): Promise<boolean>;
34
+ getComments(): FThreadComment[];
35
+ addComment(content: IDocumentBody | FTheadCommentBuilder): Promise<boolean>;
25
36
  clearComment(): Promise<boolean>;
37
+ clearComments(): Promise<boolean>;
26
38
  }
27
39
  declare module '@univerjs/sheets/facade' {
28
40
  interface FRange extends IFRangeCommentMixin {
@@ -1,7 +1,162 @@
1
- import { IDocumentBody, ICommandService, Injector, IUniverInstanceService } from '@univerjs/core';
1
+ import { IDocumentBody, ICommandService, Injector, IUniverInstanceService, RichTextValue, UserManagerService } from '@univerjs/core';
2
2
  import { IBaseComment, IThreadComment } from '@univerjs/thread-comment';
3
- import { FRange } from '@univerjs/sheets/facade';
4
3
  import { SheetsThreadCommentModel } from '@univerjs/sheets-thread-comment';
4
+ import { FRange } from '@univerjs/sheets/facade';
5
+ export declare class FTheadCommentItem {
6
+ protected _comment: IThreadComment;
7
+ /**
8
+ * Create a new FTheadCommentItem
9
+ * @param {IThreadComment|undefined} comment The comment
10
+ * @returns {FTheadCommentItem} A new instance of FTheadCommentItem
11
+ * @example
12
+ * ```ts
13
+ * const comment = univerAPI.newTheadComment();
14
+ * ```
15
+ */
16
+ static create(comment?: IThreadComment): FTheadCommentItem;
17
+ constructor(comment?: IThreadComment);
18
+ /**
19
+ * Get the person id of the comment
20
+ * @returns {string} The person id of the comment
21
+ * @example
22
+ * ```ts
23
+ * const comment = univerAPI.getActiveWorkbook()
24
+ * .getSheetById(sheetId)
25
+ * .getCommentById(commentId);
26
+ * const personId = comment.personId;
27
+ * ```
28
+ */
29
+ get personId(): string;
30
+ /**
31
+ * Get the date time of the comment
32
+ * @returns {string} The date time of the comment
33
+ * @example
34
+ * ```ts
35
+ * const comment = univerAPI.getActiveWorkbook()
36
+ * .getSheetById(sheetId)
37
+ * .getCommentById(commentId);
38
+ * const dateTime = comment.dateTime;
39
+ * ```
40
+ */
41
+ get dateTime(): string;
42
+ /**
43
+ * Get the content of the comment
44
+ * @returns {RichTextValue} The content of the comment
45
+ * @example
46
+ * ```ts
47
+ * const comment = univerAPI.getActiveWorkbook()
48
+ * .getSheetById(sheetId)
49
+ * .getCommentById(commentId);
50
+ * const content = comment.content;
51
+ * ```
52
+ */
53
+ get content(): RichTextValue;
54
+ /**
55
+ * Get the id of the comment
56
+ * @returns {string} The id of the comment
57
+ * @example
58
+ * ```ts
59
+ * const comment = univerAPI.getActiveWorkbook()
60
+ * .getSheetById(sheetId)
61
+ * .getCommentById(commentId);
62
+ * const id = comment.id;
63
+ * ```
64
+ */
65
+ get id(): string;
66
+ /**
67
+ * Get the thread id of the comment
68
+ * @returns {string} The thread id of the comment
69
+ * @example
70
+ * ```ts
71
+ * const comment = univerAPI.getActiveWorkbook()
72
+ * .getSheetById(sheetId)
73
+ * .getCommentById(commentId);
74
+ * const threadId = comment.threadId;
75
+ * ```
76
+ */
77
+ get threadId(): string;
78
+ /**
79
+ * Copy the comment
80
+ * @returns {FTheadCommentBuilder} The comment builder
81
+ * @example
82
+ * ```ts
83
+ * const comment = univerAPI.getActiveWorkbook()
84
+ * .getSheetById(sheetId)
85
+ * .getCommentById(commentId);
86
+ * const newComment = comment.copy();
87
+ * ```
88
+ */
89
+ copy(): FTheadCommentBuilder;
90
+ }
91
+ export declare class FTheadCommentBuilder extends FTheadCommentItem {
92
+ static create(comment?: IThreadComment): FTheadCommentBuilder;
93
+ /**
94
+ * Set the content of the comment
95
+ * @param {IDocumentBody | RichTextValue} content The content of the comment
96
+ * @returns {FTheadCommentBuilder} The comment builder
97
+ * @example
98
+ * ```ts
99
+ * const comment = univerAPI.newTheadComment()
100
+ * .setContent(univerAPI.newRichText().insertText('hello zhangsan'));
101
+ * ```
102
+ */
103
+ setContent(content: IDocumentBody | RichTextValue): FTheadCommentBuilder;
104
+ /**
105
+ * Set the person id of the comment
106
+ * @param {string} userId The person id of the comment
107
+ * @returns {FTheadCommentBuilder} The comment builder
108
+ * @example
109
+ * ```ts
110
+ * const comment = univerAPI.newTheadComment()
111
+ * .setPersonId('123');
112
+ * ```
113
+ */
114
+ setPersonId(userId: string): FTheadCommentBuilder;
115
+ /**
116
+ * Set the date time of the comment
117
+ * @param {Date} date The date time of the comment
118
+ * @returns {FTheadCommentBuilder} The comment builder
119
+ * @example
120
+ * ```ts
121
+ * const comment = univerAPI.newTheadComment()
122
+ * .setDateTime(new Date());
123
+ * ```
124
+ */
125
+ setDateTime(date: Date): FTheadCommentBuilder;
126
+ /**
127
+ * Set the id of the comment
128
+ * @param {string} id The id of the comment
129
+ * @returns {FTheadCommentBuilder} The comment builder
130
+ * @example
131
+ * ```ts
132
+ * const comment = univerAPI.newTheadComment()
133
+ * .setId('123');
134
+ * ```
135
+ */
136
+ setId(id: string): FTheadCommentBuilder;
137
+ /**
138
+ * Set the thread id of the comment
139
+ * @param {string} threadId The thread id of the comment
140
+ * @returns {FTheadCommentBuilder} The comment builder
141
+ * @example
142
+ * ```ts
143
+ * const comment = univerAPI.newTheadComment()
144
+ * .setThreadId('123');
145
+ * ```
146
+ */
147
+ setThreadId(threadId: string): FTheadCommentBuilder;
148
+ /**
149
+ * Build the comment
150
+ * @returns {IThreadComment} The comment
151
+ * @example
152
+ * ```ts
153
+ * const comment = univerAPI.newTheadComment()
154
+ * .setContent(univerAPI.newRichText().insertText('hello zhangsan'))
155
+ * .build();
156
+ * ```
157
+ */
158
+ build(): IThreadComment;
159
+ }
5
160
  export declare class FThreadComment {
6
161
  private readonly _thread;
7
162
  private readonly _parent;
@@ -9,48 +164,140 @@ export declare class FThreadComment {
9
164
  private readonly _commandService;
10
165
  private readonly _univerInstanceService;
11
166
  private readonly _threadCommentModel;
12
- constructor(_thread: IThreadComment | IBaseComment, _parent: IThreadComment | undefined, _injector: Injector, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _threadCommentModel: SheetsThreadCommentModel);
167
+ private readonly _userManagerService;
168
+ constructor(_thread: IThreadComment | IBaseComment, _parent: IThreadComment | undefined, _injector: Injector, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _threadCommentModel: SheetsThreadCommentModel, _userManagerService: UserManagerService);
13
169
  private _getRef;
14
170
  /**
15
171
  * Whether the comment is a root comment
16
172
  * @returns Whether the comment is a root comment
173
+ * @example
174
+ * ```ts
175
+ * const comment = univerAPI.getActiveWorkbook()
176
+ * .getSheetById(sheetId)
177
+ * .getCommentById(commentId);
178
+ * const isRoot = comment.getIsRoot();
179
+ * ```
17
180
  */
18
181
  getIsRoot(): boolean;
19
182
  /**
20
183
  * Get the comment data
21
184
  * @returns The comment data
185
+ * @example
186
+ * ```ts
187
+ * const comment = univerAPI.getActiveWorkbook()
188
+ * .getSheetById(sheetId)
189
+ * .getCommentById(commentId);
190
+ * const commentData = comment.getCommentData();
191
+ * ```
22
192
  */
23
193
  getCommentData(): IBaseComment;
24
194
  /**
25
195
  * Get the replies of the comment
26
196
  * @returns the replies of the comment
197
+ * @example
198
+ * ```ts
199
+ * const comment = univerAPI.getActiveWorkbook()
200
+ * .getSheetById(sheetId)
201
+ * .getCommentById(commentId);
202
+ * const replies = comment.getReplies();
203
+ * ```
27
204
  */
28
205
  getReplies(): FThreadComment[] | undefined;
29
206
  /**
30
207
  * Get the range of the comment
31
208
  * @returns The range of the comment
209
+ * @example
210
+ * ```ts
211
+ * const comment = univerAPI.getActiveWorkbook()
212
+ * .getSheetById(sheetId)
213
+ * .getCommentById(commentId);
214
+ * const range = comment.getRange();
215
+ * ```
32
216
  */
33
217
  getRange(): FRange | null;
34
218
  /**
35
- * Get the content of the comment
36
- * @returns The content of the comment
219
+ * @deprecated use `getRichText` as instead
37
220
  */
38
221
  getContent(): IDocumentBody;
222
+ /**
223
+ * Get the rich text of the comment
224
+ * @returns {RichTextValue} The rich text of the comment
225
+ * @example
226
+ * ```ts
227
+ * const comment = univerAPI.getActiveWorkbook()
228
+ * .getSheetById(sheetId)
229
+ * .getCommentById(commentId);
230
+ * const richText = comment.getRichText();
231
+ * ```
232
+ */
233
+ getRichText(): RichTextValue;
39
234
  /**
40
235
  * Delete the comment and it's replies
41
- * @returns success or not
236
+ * @returns {Promise<boolean>} success or not
237
+ * @example
238
+ * ```ts
239
+ * const comment = univerAPI.getActiveWorkbook()
240
+ * .getSheetById(sheetId)
241
+ * .getCommentById(commentId);
242
+ * const success = await comment.deleteAsync();
243
+ * ```
244
+ */
245
+ deleteAsync(): Promise<boolean>;
246
+ /**
247
+ * @deprecated use `deleteAsync` as instead.
42
248
  */
43
249
  delete(): Promise<boolean>;
250
+ /**
251
+ * @param content
252
+ * @deprecated use `updateAsync` as instead
253
+ */
254
+ update(content: IDocumentBody): Promise<boolean>;
44
255
  /**
45
256
  * Update the comment content
46
257
  * @param content The new content of the comment
47
258
  * @returns success or not
259
+ * @example
260
+ * ```ts
261
+ * const comment = univerAPI.getActiveWorkbook()
262
+ * .getSheetById(sheetId)
263
+ * .getCommentById(commentId);
264
+ * const success = await comment.updateAsync(univerAPI.newRichText().insertText('hello zhangsan'));
265
+ * ```
48
266
  */
49
- update(content: IDocumentBody): Promise<boolean>;
267
+ updateAsync(content: IDocumentBody | RichTextValue): Promise<boolean>;
268
+ /**
269
+ * @param resolved
270
+ * @deprecated use `resolveAsync` as instead
271
+ */
272
+ resolve(resolved?: boolean): Promise<boolean>;
50
273
  /**
51
274
  * Resolve the comment
52
275
  * @param resolved Whether the comment is resolved
53
276
  * @returns success or not
277
+ * @example
278
+ * ```ts
279
+ * const comment = univerAPI.getActiveWorkbook()
280
+ * .getSheetById(sheetId)
281
+ * .getCommentById(commentId);
282
+ * const success = await comment.resolveAsync(true);
283
+ * ```
54
284
  */
55
- resolve(resolved?: boolean): Promise<boolean>;
285
+ resolveAsync(resolved?: boolean): Promise<boolean>;
286
+ /**
287
+ * Reply to the comment
288
+ * @param comment The comment to reply to
289
+ * @returns success or not
290
+ * @example
291
+ * ```ts
292
+ * const comment = univerAPI.getActiveWorkbook()
293
+ * .getSheetById(sheetId)
294
+ * .getCommentById(commentId);
295
+ *
296
+ * const reply = univerAPI.newTheadComment()
297
+ * .setContent(univerAPI.newRichText().insertText('hello zhangsan'));
298
+ *
299
+ * const success = await comment.replyAsync(reply);
300
+ * ```
301
+ */
302
+ replyAsync(comment: FTheadCommentBuilder): Promise<boolean>;
56
303
  }
@@ -0,0 +1,41 @@
1
+ import { IDisposable, Injector, FUniver } from '@univerjs/core';
2
+ import { IThreadComment } from '@univerjs/thread-comment';
3
+ import { ISheetCommentAddEvent, ISheetCommentDeleteEvent, ISheetCommentResolveEvent, ISheetCommentUpdateEvent } from './f-event';
4
+ import { FTheadCommentBuilder } from './f-thread-comment';
5
+ export interface IFUniverCommentMixin {
6
+ /**
7
+ * @deprecated use `univerAPI.addEvent(univerAPI.event.CommentAdded, () => {})` as instead
8
+ */
9
+ onCommentAdded(callback: (event: ISheetCommentAddEvent) => void): IDisposable;
10
+ /**
11
+ * @deprecated use `univerAPI.addEvent(univerAPI.event.CommentUpdated, () => {})` as instead
12
+ */
13
+ onCommentUpdated(callback: (event: ISheetCommentUpdateEvent) => void): IDisposable;
14
+ /**
15
+ * @deprecated use `univerAPI.addEvent(univerAPI.event.CommentDeleted, () => {})` as instead
16
+ */
17
+ onCommentDeleted(callback: (event: ISheetCommentDeleteEvent) => void): IDisposable;
18
+ /**
19
+ * @deprecated use `univerAPI.addEvent(univerAPI.event.CommentResolved, () => {})` as instead
20
+ */
21
+ onCommentResolved(callback: (event: ISheetCommentResolveEvent) => void): IDisposable;
22
+ /**
23
+ * create a new thread comment
24
+ * @return {FTheadCommentBuilder} thead comment builder
25
+ * @example
26
+ * ```ts
27
+ * const comment = univerAPI.newTheadComment().setContent(univerAPI.newRichText().insertText('hello zhangsan'));
28
+ * ```
29
+ */
30
+ newTheadComment(): FTheadCommentBuilder;
31
+ }
32
+ export declare class FUniverCommentMixin extends FUniver implements IFUniverCommentMixin {
33
+ private _handleCommentCommand;
34
+ private _handleBeforeCommentCommand;
35
+ _initialize(injector: Injector): void;
36
+ newTheadComment(comment?: IThreadComment): FTheadCommentBuilder;
37
+ }
38
+ declare module '@univerjs/core' {
39
+ interface FUniver extends IFUniverCommentMixin {
40
+ }
41
+ }