@ckeditor/ckeditor5-comments 36.0.1 → 37.0.0-rc.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.
Files changed (202) hide show
  1. package/build/comments.js +2 -2
  2. package/build/translations/af.js +1 -1
  3. package/build/translations/ar.js +1 -1
  4. package/build/translations/bg.js +1 -1
  5. package/build/translations/bn.js +1 -1
  6. package/build/translations/bs.js +1 -1
  7. package/build/translations/ca.js +1 -1
  8. package/build/translations/cs.js +1 -1
  9. package/build/translations/da.js +1 -1
  10. package/build/translations/de-ch.js +1 -1
  11. package/build/translations/de.js +1 -1
  12. package/build/translations/el.js +1 -1
  13. package/build/translations/en-au.js +1 -1
  14. package/build/translations/es-co.js +1 -1
  15. package/build/translations/es.js +1 -1
  16. package/build/translations/et.js +1 -1
  17. package/build/translations/fa.js +1 -1
  18. package/build/translations/fi.js +1 -1
  19. package/build/translations/fr.js +1 -1
  20. package/build/translations/gl.js +1 -1
  21. package/build/translations/he.js +1 -1
  22. package/build/translations/hi.js +1 -1
  23. package/build/translations/hr.js +1 -1
  24. package/build/translations/hu.js +1 -1
  25. package/build/translations/id.js +1 -1
  26. package/build/translations/it.js +1 -1
  27. package/build/translations/ja.js +1 -1
  28. package/build/translations/jv.js +1 -1
  29. package/build/translations/ko.js +1 -1
  30. package/build/translations/lt.js +1 -1
  31. package/build/translations/lv.js +1 -1
  32. package/build/translations/ms.js +1 -1
  33. package/build/translations/nl.js +1 -1
  34. package/build/translations/no.js +1 -1
  35. package/build/translations/pl.js +1 -1
  36. package/build/translations/pt-br.js +1 -1
  37. package/build/translations/pt.js +1 -1
  38. package/build/translations/ro.js +1 -1
  39. package/build/translations/ru.js +1 -1
  40. package/build/translations/sk.js +1 -1
  41. package/build/translations/sr-latn.js +1 -1
  42. package/build/translations/sr.js +1 -1
  43. package/build/translations/sv.js +1 -1
  44. package/build/translations/th.js +1 -1
  45. package/build/translations/tk.js +1 -1
  46. package/build/translations/tr.js +1 -1
  47. package/build/translations/tt.js +1 -1
  48. package/build/translations/ug.js +1 -1
  49. package/build/translations/uk.js +1 -1
  50. package/build/translations/ur.js +1 -1
  51. package/build/translations/vi.js +1 -1
  52. package/build/translations/zh-cn.js +1 -1
  53. package/build/translations/zh.js +1 -1
  54. package/lang/contexts.json +8 -1
  55. package/lang/translations/af.po +28 -0
  56. package/lang/translations/ar.po +28 -0
  57. package/lang/translations/bg.po +28 -0
  58. package/lang/translations/bn.po +28 -0
  59. package/lang/translations/bs.po +28 -0
  60. package/lang/translations/ca.po +28 -0
  61. package/lang/translations/cs.po +28 -0
  62. package/lang/translations/da.po +28 -0
  63. package/lang/translations/de-ch.po +28 -0
  64. package/lang/translations/de.po +28 -0
  65. package/lang/translations/el.po +28 -0
  66. package/lang/translations/en-au.po +28 -0
  67. package/lang/translations/en.po +28 -0
  68. package/lang/translations/es-co.po +28 -0
  69. package/lang/translations/es.po +28 -0
  70. package/lang/translations/et.po +28 -0
  71. package/lang/translations/fa.po +28 -0
  72. package/lang/translations/fi.po +28 -0
  73. package/lang/translations/fr.po +28 -0
  74. package/lang/translations/gl.po +28 -0
  75. package/lang/translations/he.po +28 -0
  76. package/lang/translations/hi.po +28 -0
  77. package/lang/translations/hr.po +28 -0
  78. package/lang/translations/hu.po +28 -0
  79. package/lang/translations/id.po +28 -0
  80. package/lang/translations/it.po +28 -0
  81. package/lang/translations/ja.po +28 -0
  82. package/lang/translations/jv.po +28 -0
  83. package/lang/translations/ko.po +28 -0
  84. package/lang/translations/lt.po +28 -0
  85. package/lang/translations/lv.po +28 -0
  86. package/lang/translations/ms.po +28 -0
  87. package/lang/translations/nl.po +28 -0
  88. package/lang/translations/no.po +28 -0
  89. package/lang/translations/pl.po +28 -0
  90. package/lang/translations/pt-br.po +28 -0
  91. package/lang/translations/pt.po +28 -0
  92. package/lang/translations/ro.po +28 -0
  93. package/lang/translations/ru.po +28 -0
  94. package/lang/translations/sk.po +28 -0
  95. package/lang/translations/sr-latn.po +28 -0
  96. package/lang/translations/sr.po +29 -1
  97. package/lang/translations/sv.po +28 -0
  98. package/lang/translations/th.po +28 -0
  99. package/lang/translations/tk.po +28 -0
  100. package/lang/translations/tr.po +28 -0
  101. package/lang/translations/tt.po +28 -0
  102. package/lang/translations/ug.po +28 -0
  103. package/lang/translations/uk.po +28 -0
  104. package/lang/translations/ur.po +28 -0
  105. package/lang/translations/vi.po +28 -0
  106. package/lang/translations/zh-cn.po +28 -0
  107. package/lang/translations/zh.po +28 -0
  108. package/package.json +19 -3
  109. package/src/annotations/annotation.d.ts +86 -0
  110. package/src/annotations/annotation.js +1 -1
  111. package/src/annotations/annotationcollection.d.ts +94 -0
  112. package/src/annotations/annotationcollection.js +1 -1
  113. package/src/annotations/annotations.d.ts +150 -0
  114. package/src/annotations/annotations.js +1 -1
  115. package/src/annotations/annotationsuis.d.ts +227 -0
  116. package/src/annotations/annotationsuis.js +1 -1
  117. package/src/annotations/editorannotations.d.ts +62 -0
  118. package/src/annotations/editorannotations.js +1 -1
  119. package/src/annotations/inlineannotations.d.ts +84 -0
  120. package/src/annotations/inlineannotations.js +1 -1
  121. package/src/annotations/narrowsidebar.d.ts +80 -0
  122. package/src/annotations/narrowsidebar.js +1 -1
  123. package/src/annotations/sidebar.d.ts +96 -0
  124. package/src/annotations/sidebar.js +1 -1
  125. package/src/annotations/view/annotationcounterbuttonview.d.ts +25 -0
  126. package/src/annotations/view/annotationcounterbuttonview.js +1 -1
  127. package/src/annotations/view/annotationview.d.ts +86 -0
  128. package/src/annotations/view/annotationview.js +1 -1
  129. package/src/annotations/view/sidebaritemview.d.ts +51 -0
  130. package/src/annotations/view/sidebaritemview.js +1 -1
  131. package/src/annotations/view/sidebarview.d.ts +28 -0
  132. package/src/annotations/view/sidebarview.js +1 -1
  133. package/src/annotations/widesidebar.d.ts +72 -0
  134. package/src/annotations/widesidebar.js +1 -1
  135. package/src/augmentation.d.ts +54 -0
  136. package/src/augmentation.js +23 -0
  137. package/src/comments/addcommentthreadcommand.d.ts +31 -0
  138. package/src/comments/addcommentthreadcommand.js +1 -1
  139. package/src/comments/commentsarchive.d.ts +25 -0
  140. package/src/comments/commentsarchive.js +23 -0
  141. package/src/comments/commentsarchiveui.d.ts +32 -0
  142. package/src/comments/commentsarchiveui.js +23 -0
  143. package/src/comments/commentsediting.d.ts +71 -0
  144. package/src/comments/commentsediting.js +1 -1
  145. package/src/comments/commentsrepository.d.ts +1009 -0
  146. package/src/comments/commentsrepository.js +1 -1
  147. package/src/comments/commentsui.d.ts +25 -0
  148. package/src/comments/commentsui.js +1 -1
  149. package/src/comments/integrations/commentsrestrictededitingmode.d.ts +13 -0
  150. package/src/comments/integrations/commentsrestrictededitingmode.js +1 -1
  151. package/src/comments/integrations/importword.d.ts +17 -0
  152. package/src/comments/integrations/importword.js +1 -1
  153. package/src/comments/ui/commenteditor/commenteditor.d.ts +32 -0
  154. package/src/comments/ui/commenteditor/commenteditor.js +1 -1
  155. package/src/comments/ui/commenteditor/commenteditorui.d.ts +27 -0
  156. package/src/comments/ui/commenteditor/commenteditorui.js +1 -1
  157. package/src/comments/ui/commenteditor/commenteditoruiview.d.ts +32 -0
  158. package/src/comments/ui/commenteditor/commenteditoruiview.js +1 -1
  159. package/src/comments/ui/commentthreadcontroller.d.ts +64 -0
  160. package/src/comments/ui/commentthreadcontroller.js +1 -1
  161. package/src/comments/ui/view/basecommentthreadview.d.ts +108 -0
  162. package/src/comments/ui/view/basecommentthreadview.js +1 -1
  163. package/src/comments/ui/view/basecommentview.d.ts +108 -0
  164. package/src/comments/ui/view/basecommentview.js +1 -1
  165. package/src/comments/ui/view/collapsedcommentsview.d.ts +9 -0
  166. package/src/comments/ui/view/collapsedcommentsview.js +1 -1
  167. package/src/comments/ui/view/commentcontentview.d.ts +10 -0
  168. package/src/comments/ui/view/commentcontentview.js +1 -1
  169. package/src/comments/ui/view/commentinputview.d.ts +76 -0
  170. package/src/comments/ui/view/commentinputview.js +1 -1
  171. package/src/comments/ui/view/commentsarchiveview.d.ts +34 -0
  172. package/src/comments/ui/view/commentsarchiveview.js +23 -0
  173. package/src/comments/ui/view/commentslistview.d.ts +96 -0
  174. package/src/comments/ui/view/commentslistview.js +1 -1
  175. package/src/comments/ui/view/commentthreadheaderview.d.ts +46 -0
  176. package/src/comments/ui/view/commentthreadheaderview.js +23 -0
  177. package/src/comments/ui/view/commentthreadinputview.d.ts +37 -0
  178. package/src/comments/ui/view/commentthreadinputview.js +1 -1
  179. package/src/comments/ui/view/commentthreadview.d.ts +108 -0
  180. package/src/comments/ui/view/commentthreadview.js +1 -1
  181. package/src/comments/ui/view/commentview.d.ts +231 -0
  182. package/src/comments/ui/view/commentview.js +1 -1
  183. package/src/comments.d.ts +22 -0
  184. package/src/comments.js +1 -1
  185. package/src/commentsonly.d.ts +28 -0
  186. package/src/commentsonly.js +1 -1
  187. package/src/config.d.ts +172 -0
  188. package/src/config.js +23 -0
  189. package/src/index.d.ts +19 -0
  190. package/src/index.js +1 -1
  191. package/src/utils/common-translations.d.ts +5 -0
  192. package/src/utils/common-translations.js +1 -1
  193. package/src/utils/createmutationobserver.d.ts +13 -0
  194. package/src/utils/createmutationobserver.js +1 -1
  195. package/theme/annotation.css +1 -0
  196. package/theme/comment.css +31 -0
  197. package/theme/commentsarchive.css +40 -0
  198. package/theme/commentthread.css +68 -1
  199. package/theme/icons/add-comment.svg +1 -1
  200. package/theme/icons/comments-archive.svg +11 -0
  201. package/theme/icons/undo.svg +1 -0
  202. package/theme/sidebar.css +4 -0
@@ -0,0 +1,1009 @@
1
+ /**
2
+ * @module comments/comments/commentsrepository
3
+ * @publicApi
4
+ */
5
+ import { Context, ContextPlugin, type ContextPluginDependencies, type Editor } from 'ckeditor5/src/core';
6
+ import { Collection } from 'ckeditor5/src/utils';
7
+ import { type User } from 'ckeditor5-collaboration/src/collaboration-core';
8
+ import CommentThreadController from './ui/commentthreadcontroller';
9
+ import '../../theme/comment.css';
10
+ import '../../theme/commentthread.css';
11
+ import '../../theme/commentinput.css';
12
+ import Annotation, { type AnnotationTarget } from '../annotations/annotation';
13
+ import type BaseCommentThreadView from './ui/view/basecommentthreadview';
14
+ /**
15
+ * Stores the list of {@link module:comments/comments/commentsrepository~CommentThread}
16
+ * and provides event-driven API for managing them. It is also responsible for using the comments adapter
17
+ * to communicate with the data source.
18
+ *
19
+ * {@link module:comments/comments/commentsrepository~CommentsRepository} is a context plugin.
20
+ * It can be added to a context or to an editor. Add it to the context configuration if you use
21
+ * {@link module:core/context~Context} in your integration.
22
+ *
23
+ * The event-driven API makes it possible to attach a listener to each action that changes comment data.
24
+ * Using different event priorities allows to attach an action before the main action ('low' priority)
25
+ * or after the main action ('high' priority). It works very similar to
26
+ * {@link module:utils/observablemixin~Observable#decorate}.
27
+ *
28
+ * Sample usage:
29
+ *
30
+ * ```ts
31
+ * // Get the comments repository:
32
+ * const commentsRepository = editor.plugins.get( 'CommentsRepository' );
33
+ *
34
+ * // Create a new, empty comment thread on a DOM form field element:
35
+ * commentsRepository.openNewCommentThread( { channelId, target: formFieldElement } );
36
+ *
37
+ * // Get all comment threads:
38
+ * commentsRepository.getCommentThreads();
39
+ *
40
+ * // Set the adapter:
41
+ * commentsRepository.adapter = {
42
+ * // ...
43
+ * };
44
+ * ```
45
+ *
46
+ * For more information about the comments adapter see {@link module:comments/comments/commentsrepository~CommentsAdapter}.
47
+ */
48
+ export default class CommentsRepository extends ContextPlugin {
49
+ licenseKey: string;
50
+ /**
51
+ * The currently active comment thread.
52
+ * An annotation with this thread will be marked as active.
53
+ *
54
+ * @observable
55
+ */
56
+ activeCommentThread: CommentThread | null;
57
+ /**
58
+ * @inheritDoc
59
+ */
60
+ static get requires(): ContextPluginDependencies;
61
+ /**
62
+ * @inheritDoc
63
+ */
64
+ static get pluginName(): 'CommentsRepository';
65
+ /**
66
+ * @inheritDoc
67
+ */
68
+ constructor(context: Context | Editor);
69
+ /**
70
+ * @inheritDoc
71
+ */
72
+ init(): void;
73
+ /**
74
+ * @inheritDoc
75
+ */
76
+ afterInit(): void;
77
+ /**
78
+ * An adapter object that should communicate with the data source to fetch or save the comments data.
79
+ */
80
+ set adapter(adapter: CommentsAdapter);
81
+ get adapter(): CommentsAdapter;
82
+ /**
83
+ * Adds a new comment thread.
84
+ *
85
+ * When a target is provided, the comment annotation will be attached to this target.
86
+ *
87
+ * Use this method to load the comments data during the editor initialization
88
+ * if you do not use the adapter integration.
89
+ *
90
+ * **Note:** This method fires the {@link #event:addCommentThread} event and the default behavior
91
+ * is added as a `'normal'` priority listener. It makes it possible to cancel the method
92
+ * or call some custom code before or after the default behavior is executed.
93
+ *
94
+ * **Note:** The comments adapter will send the data only if `commentThreadData.comments`
95
+ * is not empty and `commentThreadData.isFromAdapter` is set to `false`.
96
+ *
97
+ * See also `CommentsRepository#openNewCommentThread()`.
98
+ *
99
+ * An example of loading a comment thread on editor initialization:
100
+ *
101
+ * ```ts
102
+ * commentsRepository.addCommentThread( {
103
+ * threadId: 'thread-id',
104
+ * channelId: 'channel-id',
105
+ * comments: [
106
+ * {
107
+ * commentId: 'comment-1', // String
108
+ * authorId: 'author-id', // String
109
+ * content: 'First comment', // String
110
+ * createdAt: new Date( ... ) // Date instance
111
+ * },
112
+ * // ...
113
+ * ],
114
+ * target: () => ...,
115
+ * // Added during initialization, so do not call the adapter:
116
+ * isFromAdapter: true
117
+ * } );
118
+ * ```
119
+ *
120
+ * @fires addCommentThread
121
+ * @param commentThreadData The data of the comment thread to add.
122
+ * @param data.channelId The ID of a document or context to which the comment thread is added.
123
+ * @param data.threadId The ID of the added comment thread.
124
+ * @param data.comments Comments in the comment thread. See the example above.
125
+ * @param data.resolvedAt The date when the comment thread has been resolved.
126
+ * @param data.resolvedBy The ID of user who resolved the comment thread.
127
+ * @param data.target The target that the comment
128
+ * balloon should be attached to. If a function is passed, it should return a DOM element or `Rect`.
129
+ * @param data.context The text on which the comment thread was created on or other context for the thread.
130
+ * Displayed for resolved comment threads.
131
+ * @param data.attributes Custom comment attributes. See also
132
+ * {@link module:comments/comments/commentsrepository~CommentThread#setAttribute} and
133
+ * {@link module:comments/comments/commentsrepository~CommentThread#removeAttribute}.
134
+ * @param data.isResolvable Indicates whether the comment thread can become resolved.
135
+ * Set this flag to `false` to disable the possibility of resolving given comment thread.
136
+ * @param data.isFromAdapter A flag describing whether the added data
137
+ * comes from an adapter (`true`) or is a new data (`false`). If set to `true`, the
138
+ * comment data will be added only in the editor and will not be sent to the adapter.
139
+ * @returns The added comment thread.
140
+ */
141
+ addCommentThread({ channelId, threadId, comments, resolvedAt, resolvedBy, target, context, attributes, isResolvable, isSubmitted, isFromAdapter }?: AddCommentThreadEventData): CommentThread | undefined;
142
+ /**
143
+ * Creates a new, empty comment thread.
144
+ *
145
+ * Displays a new comment annotation attached to the target and focuses the comment editor.
146
+ * When the comment data is submitted, the comment thread is added to the editor
147
+ * and sent to the adapter.
148
+ *
149
+ * Use this method to start a new comment thread after a user performed an action
150
+ * (clicked a button, etc.).
151
+ *
152
+ * @fires addCommentThread
153
+ * @param commentThreadData.channelId The ID of a document or context to which the comment is added.
154
+ * @param commentThreadData.threadId The ID of the comment thread.
155
+ * Random id will be generated if it is not set. All thread IDs should be unique.
156
+ * @param commentThreadData.target The target that the comment
157
+ * balloon should be attached to. If a function is passed, it should return a DOM element or `Rect`.
158
+ * @param commentThreadData.context The text on which the comment thread was created on.
159
+ * @param commentThreadData.isResolvable Indicates whether the comment thread can become resolved.
160
+ * Set this flag to `false` to disable the possibility of resolving given comment thread.
161
+ * @returns The created comment thread or `null` if there was a problem
162
+ * creating the thread (for example, if the comments repository was in the read-only mode).
163
+ */
164
+ openNewCommentThread({ channelId, threadId, target, context, isResolvable }: AddCommentThreadEventData): CommentThread | null;
165
+ /**
166
+ * Checks if a comment thread with a given ID is added to the repository.
167
+ */
168
+ hasCommentThread(threadId: string): boolean;
169
+ /**
170
+ * Updates existing comment thread.
171
+ *
172
+ * @fires updateCommentThread
173
+ * @param data The data of the comment thread to add.
174
+ * @param data.channelId The ID of a document or context to which the comment thread is added.
175
+ * @param data.threadId The ID of the updated comment thread.
176
+ * @param data.resolvedAt The date when the comment thread has been resolved.
177
+ * @param data.resolvedBy The ID of user who resolved the comment thread.
178
+ * @param data.isFromAdapter A flag describing whether the added data
179
+ * comes from an adapter (`true`) or is a new data (`false`). If set to `true`, the
180
+ * comment data will be added only in the editor and will not be sent to the adapter.
181
+ * @returns The updated comment thread.
182
+ */
183
+ updateCommentThread({ channelId, threadId, context, attributes, isFromAdapter }?: UpdateCommentThreadEventData): CommentThread;
184
+ /**
185
+ * Returns comment thread of given id.
186
+ */
187
+ getCommentThread(threadId: string): CommentThread | undefined;
188
+ /**
189
+ * Gets the comment thread data using the adapter and adds the thread to the editor.
190
+ *
191
+ * When the comment thread is already present in the repository,
192
+ * then the adapter will not be used but the result will be asynchronous as well.
193
+ */
194
+ fetchCommentThread({ channelId, threadId }?: BaseCommentThread): Promise<CommentThread | undefined>;
195
+ getCommentThreads(data?: {
196
+ channelId?: string | symbol;
197
+ skipNotAttached?: boolean;
198
+ skipEmpty?: boolean;
199
+ toJSON?: false;
200
+ }): Array<CommentThread>;
201
+ getCommentThreads(data: {
202
+ channelId?: string | symbol;
203
+ skipNotAttached?: boolean;
204
+ skipEmpty?: boolean;
205
+ toJSON: true;
206
+ }): Array<CommentThreadDataJSON>;
207
+ /**
208
+ * Marks a comment thread with the given ID as active.
209
+ * When `threadId` is `null`, the currently active comment thread will be deactivated.
210
+ */
211
+ setActiveCommentThread(threadId: string | null): void;
212
+ /**
213
+ * Changes the read-only state for comment threads.
214
+ *
215
+ * When the value is `true` then all comment threads will be switched to read-only,
216
+ * when the value is `false` then all comment threads will be switched to editing mode.
217
+ *
218
+ * Optionally new state can be applied to a comment threads limited to a given channel.
219
+ * This function has precedence over any permission settings.
220
+ */
221
+ switchReadOnly(value: boolean, channelId?: string | symbol): void;
222
+ /**
223
+ * Returns `true` if a given channel is set to read-only mode, returns `false` otherwise.
224
+ */
225
+ isReadOnly(channelId: string | symbol): boolean;
226
+ /**
227
+ * Create an instance of the {@link module:comments/comments/ui/commentthreadcontroller~CommentThreadController} class.
228
+ *
229
+ * @param commentThreadModel Comment thread model.
230
+ * @param commentThreadView Comment thread view.
231
+ */
232
+ createCommentThreadController(commentThreadModel: CommentThread, commentThreadView: BaseCommentThreadView): CommentThreadController;
233
+ }
234
+ declare const CommentThread_base: {
235
+ new (): import("ckeditor5/src/utils").Observable;
236
+ prototype: import("ckeditor5/src/utils").Observable;
237
+ };
238
+ /**
239
+ * Comment thread representation.
240
+ * Stores a list of {@link module:comments/comments/commentsrepository~Comment `Comments`}.
241
+ */
242
+ export declare class CommentThread extends CommentThread_base {
243
+ /**
244
+ * Informs if the comment thread is in read-only state (`true`) or not (`false`).
245
+ *
246
+ * @observable
247
+ */
248
+ isReadOnly: boolean;
249
+ /**
250
+ * Informs if the comment thread can be removed by the local user.
251
+ *
252
+ * @observable
253
+ */
254
+ isRemovable: boolean;
255
+ /**
256
+ * User id which resolved the comment thread.
257
+ *
258
+ * @observable
259
+ */
260
+ resolvedBy: User | null;
261
+ /**
262
+ * Date when the comment thread has been resolved.
263
+ *
264
+ * @observable
265
+ */
266
+ resolvedAt: Date | null;
267
+ /**
268
+ * Informs if the comment thread is resolved.
269
+ *
270
+ * @observable
271
+ */
272
+ readonly isResolved: boolean;
273
+ /**
274
+ * Custom comment thread attributes. See also {@link #setAttribute} and {@link #removeAttribute}.
275
+ *
276
+ * @observable
277
+ */
278
+ attributes: Record<string, unknown>;
279
+ /**
280
+ * The channel where the comment thread was created.
281
+ */
282
+ channelId: string | symbol;
283
+ /**
284
+ * The comment thread ID.
285
+ */
286
+ id: string;
287
+ /**
288
+ * A collection of {@link module:comments/comments/commentsrepository~Comment}s belonging to this thread.
289
+ *
290
+ * @readonly
291
+ */
292
+ readonly comments: Collection<Comment>;
293
+ constructor(commentsRepository: CommentsRepository, data: {
294
+ channelId: string | symbol;
295
+ id: string;
296
+ author: User | null;
297
+ context: CommentThreadContext;
298
+ attributes: Record<string, unknown>;
299
+ resolvedAt: Date | null;
300
+ resolvedBy: User | null;
301
+ isResolvable: boolean;
302
+ isSubmitted: boolean;
303
+ });
304
+ /**
305
+ * Sum of {@link module:comments/comments/commentsrepository~Comment#weight weights of all comments} in this thread.
306
+ */
307
+ get weight(): number;
308
+ /**
309
+ * The number of {@link module:comments/comments/commentsrepository~Comment comments} in the comment thread.
310
+ */
311
+ get length(): number;
312
+ /**
313
+ * Informs if the comment thread is attached to any target at the moment.
314
+ */
315
+ get isAttached(): boolean;
316
+ /**
317
+ * Informs if the comment thread has been submitted.
318
+ */
319
+ get isSubmitted(): boolean;
320
+ /**
321
+ * Submits the locally created comment thread draft.
322
+ */
323
+ submit(): void;
324
+ /**
325
+ * Resolves the comment thread.
326
+ */
327
+ resolve({ resolvedAt, resolvedBy, isFromAdapter }?: {
328
+ resolvedAt?: Date | undefined;
329
+ resolvedBy?: null | undefined;
330
+ isFromAdapter?: boolean | undefined;
331
+ }): void;
332
+ /**
333
+ * Reopens the resolved comment thread.
334
+ */
335
+ reopen({ isFromAdapter }?: {
336
+ isFromAdapter?: boolean | undefined;
337
+ }): void;
338
+ /**
339
+ * Set the context on the comment thread.
340
+ * This method should be called only when the context has been not set during initialization.
341
+ *
342
+ * @param context Text context of comment thread.
343
+ */
344
+ setContext(context: CommentThreadContext): void;
345
+ /**
346
+ * Adds attribute to the comment thread.
347
+ *
348
+ * Comment thread attributes are custom data that can be set and used by features
349
+ * built around comments. Use it to store your feature data with other comment thread data.
350
+ * You can also group multiple values in an object, using dot notation:
351
+ *
352
+ * ```ts
353
+ * commentThread.setAttribute( 'customData.isImportant', true );
354
+ * ```
355
+ *
356
+ * Attributes set on the comment can be accessed through the `attribute` property:
357
+ *
358
+ * ```ts
359
+ * const isImportant = commentThread.attributes.customData.isImportant;
360
+ * ```
361
+ *
362
+ * You can also observe the `attributes` property or bind other properties to it:
363
+ *
364
+ * ```ts
365
+ * myObj.bind( 'customData' ).to( commentThread, 'attributes', attributes => attributes.customData );
366
+ * ```
367
+ *
368
+ * Whenever `setAttribute()` or `removeAttribute()` is called, the `attributes` property
369
+ * is re-set and observables are refreshed.
370
+ *
371
+ * @fires module:comments/comments/commentsrepository~CommentsRepository#event:updateCommentThread
372
+ * @param name Attribute name.
373
+ * @param value Attribute value.
374
+ */
375
+ setAttribute(name: string, value: unknown): void;
376
+ /**
377
+ * Removes a comment attribute.
378
+ *
379
+ * See also {@link module:comments/comments/commentsrepository~CommentThread#setAttribute}.
380
+ *
381
+ * @fires module:comments/comments/commentsrepository~CommentsRepository#event:updateCommentThread
382
+ * @param name The attribute name.
383
+ */
384
+ removeAttribute(name: string): void;
385
+ /**
386
+ * Removes comment thread.
387
+ *
388
+ * **Note** This method is event-driven. It means it fires an event then a normal priority listener catches
389
+ * it and executes an action. It makes it possible to add some actions before and after method will be executed.
390
+ *
391
+ * @fires module:comments/comments/commentsrepository~RemoveCommentThreadEvent
392
+ */
393
+ remove({ isFromAdapter }?: {
394
+ isFromAdapter?: boolean | undefined;
395
+ }): void;
396
+ /**
397
+ * Creates comment annotations and displays it attached to the given target.
398
+ *
399
+ * @returns Created annotation.
400
+ */
401
+ attachTo(target: AnnotationTarget): Annotation;
402
+ /**
403
+ * Creates a new comment inside the comment thread.
404
+ *
405
+ * **Note** This method is event-driven. It means it fires an event then a normal priority listener catches
406
+ * it and executes an action. It makes it possible to add some actions before and after method will be executed.
407
+ *
408
+ * @fires module:comments/comments/commentsrepository~CommentsRepository#event:addComment
409
+ * @param data Data object.
410
+ * @param data.commentId Comment id.
411
+ * @param data.content Comment content.
412
+ * @param data.authorId Author id.
413
+ * @param data.createdAt Creation date. If not set, current date (`new Date()`) will be used.
414
+ * @param data.attributes Custom comment attributes. See also
415
+ * {@link module:comments/comments/commentsrepository~Comment#setAttribute} and
416
+ * {@link module:comments/comments/commentsrepository~Comment#removeAttribute}.
417
+ */
418
+ addComment(data: CommentData): void;
419
+ /**
420
+ * Returns comment of given id.
421
+ */
422
+ getComment(commentId: string): Comment | null;
423
+ toJSON(): CommentThreadDataJSON;
424
+ }
425
+ declare const Comment_base: {
426
+ new (): import("ckeditor5/src/utils").Observable;
427
+ prototype: import("ckeditor5/src/utils").Observable;
428
+ };
429
+ /**
430
+ * Single comment representation. A part of a {@link module:comments/comments/commentsrepository~CommentThread commentThread}.
431
+ */
432
+ export declare class Comment extends Comment_base {
433
+ /**
434
+ * When is set to `true`, editing the comment is blocked.
435
+ *
436
+ * @observable
437
+ */
438
+ readonly isEditable: boolean;
439
+ /**
440
+ * When is set to `false`, removing the comment is blocked.
441
+ *
442
+ * @observable
443
+ */
444
+ readonly isRemovable: boolean;
445
+ /**
446
+ * The read-only state inherited from the parent {@link module:comments/comments/commentsrepository~CommentThread}.
447
+ * When is set to `true`, then removing and editing the comment thread is blocked.
448
+ *
449
+ * In contrast to {@link #isEditable} and {@link #isRemovable}, this state can be used to
450
+ * hide some UI parts instead of temporarily disabling them.
451
+ *
452
+ * @observable
453
+ */
454
+ readonly isReadOnly: boolean;
455
+ /**
456
+ * The comment content.
457
+ */
458
+ content: string;
459
+ /**
460
+ * Date when the comment was made.
461
+ *
462
+ * Usually the same as {@link #createdAt `createdAt`} but may be different in some cases
463
+ * (e.g. when comment was added from an external source).
464
+ *
465
+ * @observable
466
+ */
467
+ authoredAt: Date;
468
+ /**
469
+ * The date when the comment thread was resolved or `null` if it is not resolved.
470
+ *
471
+ * @observable
472
+ */
473
+ resolvedAt: Date | null;
474
+ /**
475
+ * Custom comment attributes. See also {@link #setAttribute} and {@link #removeAttribute}.
476
+ *
477
+ * @observable
478
+ */
479
+ attributes: Record<string, any>;
480
+ /**
481
+ * The comment ID.
482
+ */
483
+ readonly id: string;
484
+ /**
485
+ * The ID of the comment thread that contains this comment.
486
+ */
487
+ readonly threadId: string;
488
+ /**
489
+ * The comment author.
490
+ */
491
+ readonly author: User;
492
+ /**
493
+ * The user which saved the comment data in the database.
494
+ *
495
+ * Usually the same as author but may be different in some cases (e.g. when comment was added from an external source).
496
+ */
497
+ readonly creator: User;
498
+ /**
499
+ * The flag indicating whether the comment comes from an external source.
500
+ */
501
+ readonly isExternal: boolean;
502
+ /**
503
+ * Date when the comment was saved in the database.
504
+ */
505
+ createdAt: Date;
506
+ /**
507
+ * @param commentsRepository
508
+ * @param data Configuration object.
509
+ * @param data.id Comment id.
510
+ * @param data.threadId Comment thread id.
511
+ * @param data.content Comment content.
512
+ * @param data.author Comment author.
513
+ * @param data.creator The user which saved the comment data.
514
+ * Usually the same as author but may be different in some cases (e.g. when comment was added from an external source).
515
+ * @param data.createdAt Date when the comment was saved in the database.
516
+ * @param data.authoredAt Date when the comment was made.
517
+ * @param data.attributes Custom comment attributes. See also
518
+ * {@link module:comments/comments/commentsrepository~Comment#setAttribute} and
519
+ * {@link module:comments/comments/commentsrepository~Comment#removeAttribute}.
520
+ */
521
+ constructor(commentsRepository: CommentsRepository, data: {
522
+ id: string;
523
+ threadId: string;
524
+ content: string;
525
+ author: User;
526
+ creator: User;
527
+ createdAt: Date;
528
+ authoredAt: Date;
529
+ attributes: Record<string, unknown>;
530
+ });
531
+ /**
532
+ * The comment weight.
533
+ *
534
+ * It is equal to the length of the comment content, however it is never smaller than `200`.
535
+ * This limit is set to avoid a long list of very short not collapsed comments.
536
+ */
537
+ get weight(): number;
538
+ /**
539
+ * Updates the comment with provided data.
540
+ *
541
+ * **Note:** This method fires the {@link module:comments/comments/commentsrepository~CommentsRepository#event:updateComment}
542
+ * event and the default behavior is added as a normal priority listener. It makes it
543
+ * possible to cancel the method or call some custom code before or after the default
544
+ * behavior is executed.
545
+ *
546
+ * @fires module:comments/comments/commentsrepository~CommentsRepository#event:updateComment
547
+ * @param data Data object.
548
+ * @param data.content Comment content.
549
+ * @param data.createdAt Creation date.
550
+ * @param data.attributes Custom comment attributes. See also
551
+ * {@link module:comments/comments/commentsrepository~Comment#setAttribute} and
552
+ * {@link module:comments/comments/commentsrepository~Comment#removeAttribute}.
553
+ * @param data.isFromAdapter
554
+ */
555
+ update(data: UpdateCommentData): void;
556
+ /**
557
+ * Adds attribute to the comment.
558
+ *
559
+ * Comment attributes are custom data that can be set and used by features
560
+ * built around comments. Use it to store your feature data with other comment data.
561
+ *
562
+ * comment.setAttribute( 'isImportant', true );
563
+ *
564
+ * You can group multiple values in an object, using dot notation:
565
+ *
566
+ * comment.setAttribute( 'customData.type', 'image' );
567
+ * comment.setAttribute( 'customData.src', 'foo.jpg' );
568
+ *
569
+ * Attributes set on the comment can be accessed through the `attribute` property:
570
+ *
571
+ * const isImportant = comment.attributes.isImportant;
572
+ * const type = comment.attributes.customData.type;
573
+ *
574
+ * You can also observe the `attributes` property or bind other properties to it:
575
+ *
576
+ * myObj.bind( 'customData' ).to( comment, 'attributes', attributes => attributes.customData );
577
+ *
578
+ * Whenever `setAttribute()` or `removeAttribute()` is called, the `attributes` property
579
+ * is re-set and observables are refreshed.
580
+ *
581
+ * @fires module:comments/comments/commentsrepository~CommentsRepository#event:updateComment
582
+ * @param name Attribute name.
583
+ * @param value Attribute value.
584
+ */
585
+ setAttribute(name: string, value: unknown): void;
586
+ /**
587
+ * Removes a comment attribute.
588
+ *
589
+ * See also {@link module:comments/comments/commentsrepository~Comment#setAttribute}.
590
+ *
591
+ * @fires module:comments/comments/commentsrepository~CommentsRepository#event:updateComment
592
+ * @param name The attribute name.
593
+ */
594
+ removeAttribute(name: string): void;
595
+ /**
596
+ * Removes the comment.
597
+ *
598
+ * **Note:** This method fires the {@link module:comments/comments/commentsrepository~CommentsRepository#event:updateComment}
599
+ * event and the default behavior is added as a normal priority listener. It makes it
600
+ * possible to cancel the method or call some custom code before or after the default
601
+ * behavior is executed.
602
+ *
603
+ * @fires module:comments/comments/commentsrepository~CommentsRepository#event:removeComment
604
+ * @param data.isFromAdapter A flag describing whether the comment was
605
+ * updated from an adapter (`true`) or from the UI (`false`). If set to `true`, the adapter will not be called.
606
+ */
607
+ remove(data?: {
608
+ isFromAdapter?: boolean;
609
+ }): void;
610
+ toJSON(): CommentDataJSON;
611
+ /**
612
+ * Destroys the comment instance.
613
+ */
614
+ destroy(): void;
615
+ }
616
+ export type CommentThreadContext = null | {
617
+ type: string;
618
+ value: unknown;
619
+ };
620
+ /**
621
+ * @param channelId The ID of a document or context that the comment thread is handled.
622
+ * @param threadId The ID of the comment thread.
623
+ * @param isFromAdapter A flag describing whether the operation was done on a remote client (`true`) or a local one (`false`).
624
+ */
625
+ interface BaseCommentThread {
626
+ channelId: string | symbol;
627
+ threadId: string;
628
+ isFromAdapter?: boolean;
629
+ }
630
+ /**
631
+ * @param commentId The comment ID.
632
+ */
633
+ interface BaseComment extends BaseCommentThread {
634
+ commentId: string;
635
+ }
636
+ /**
637
+ * @param content The comment content.
638
+ * @param attributes Comment custom attributes.
639
+ */
640
+ interface BaseCommentData {
641
+ content: string;
642
+ attributes: Record<string, any>;
643
+ }
644
+ /**
645
+ * Fired whenever a comment thread is added to the comments repository.
646
+ *
647
+ * The event name includes `channelId` so it is possible to listen only
648
+ * on changes happening in the specified channel.
649
+ *
650
+ * ```ts
651
+ * const channelId = 'foo';
652
+ *
653
+ * commentsRepository.on( `addCommentThread:${ channelId }`, ( evt, data ) => {
654
+ * console.log( evt, data );
655
+ * } );
656
+ * ```
657
+ *
658
+ * @eventName ~CommentsRepository#addCommentThread
659
+ */
660
+ export type AddCommentThreadEvent = {
661
+ name: string;
662
+ args: [Required<AddCommentThreadEventData>];
663
+ };
664
+ /**
665
+ * @param context The comment ID.
666
+ * @param attributes Comment thread custom attributes.
667
+ * @param resolvedAt ID of the comment author.
668
+ * @param resolvedBy The comment creation date.
669
+ */
670
+ export type CommentThreadData = BaseCommentThread & Partial<{
671
+ context: CommentThreadContext;
672
+ attributes: Record<string, any> | null;
673
+ resolvedAt: Date | null;
674
+ resolvedBy: string | null;
675
+ }>;
676
+ /**
677
+ * @param comments Comments in the comment thread.
678
+ * @param target The target that the comment balloon should be attached to.
679
+ */
680
+ export type AddCommentThreadEventData = CommentThreadData & {
681
+ comments?: Array<CommentData>;
682
+ target?: AnnotationTarget;
683
+ isResolvable?: boolean;
684
+ isSubmitted?: boolean;
685
+ };
686
+ /**
687
+ * Fired whenever a new comment thread is submitted and occurs after creating the first comment.
688
+ *
689
+ * The event name includes `channelId` so it is possible to listen only
690
+ * on changes happening in the specified channel.
691
+ *
692
+ * ```ts
693
+ * const channelId = 'foo';
694
+ *
695
+ * commentsRepository.on( `submitCommentThread:${ channelId }`, ( evt, data ) => {
696
+ * console.log( evt, data );
697
+ * } );
698
+ * ```
699
+ *
700
+ * @eventName ~CommentsRepository#submitCommentThread
701
+ */
702
+ export type SubmitCommentThreadEvent = {
703
+ name: string;
704
+ args: [BaseCommentThread];
705
+ };
706
+ /**
707
+ * Fired whenever a comment thread is updated in comments repository.
708
+ *
709
+ * The event name includes `channelId` so it is possible to listen only
710
+ * on changes happening in the specified channel.
711
+ *
712
+ * @eventName ~CommentsRepository#updateCommentThread
713
+ */
714
+ export type UpdateCommentThreadEvent = {
715
+ name: string;
716
+ args: [UpdateCommentThreadEventData];
717
+ };
718
+ export type UpdateCommentThreadEventData = Omit<CommentThreadData, 'resolvedAt' | 'resolvedBy'>;
719
+ /**
720
+ * Fired whenever a comment thread is resolved.
721
+ *
722
+ * The event name includes `channelId` so it is possible to listen only
723
+ * on changes happening in the specified channel.
724
+ *
725
+ * ```ts
726
+ * const channelId = 'foo';
727
+ *
728
+ * commentsRepository.on( `resolveCommentThread:${ channelId }`, ( evt, data ) => {
729
+ * console.log( evt, data );
730
+ * } );
731
+ * ```
732
+ *
733
+ * @eventName ~CommentsRepository#resolveCommentThread
734
+ */
735
+ export type ResolveCommentThreadEvent = {
736
+ name: string;
737
+ args: [ResolveCommentThreadEventData];
738
+ };
739
+ export type ResolveCommentThreadEventData = Required<Omit<CommentThreadData, 'context' | 'attributes'>>;
740
+ /**
741
+ * Fired whenever a comment thread is reopened.
742
+ *
743
+ * The event name includes `channelId` so it is possible to listen only
744
+ * on changes happening in the specified channel.
745
+ *
746
+ * ```ts
747
+ * const channelId = 'foo';
748
+ *
749
+ * commentsRepository.on( `reopenCommentThread:${ channelId }`, ( evt, data ) => {
750
+ * console.log( evt, data );
751
+ * } );
752
+ * ```
753
+ *
754
+ * @eventName ~CommentsRepository#reopenCommentThread
755
+ */
756
+ export type ReopenCommentThreadEvent = {
757
+ name: string;
758
+ args: [BaseCommentThread];
759
+ };
760
+ /**
761
+ * Fired whenever a comment thread is removed from the comments repository.
762
+ *
763
+ * The event name includes `channelId` so it is possible to listen only
764
+ * on changes happening in the specified channel.
765
+ *
766
+ * ```ts
767
+ * const channelId = 'foo';
768
+ *
769
+ * commentsRepository.on( `removeCommentThread:${ channelId }`, ( evt, data ) => {
770
+ * console.log( evt, data );
771
+ * } );
772
+ * ```
773
+ *
774
+ * @eventName ~CommentsRepository#removeCommentThread
775
+ */
776
+ export type RemoveCommentThreadEvent = {
777
+ name: string;
778
+ args: [BaseCommentThread];
779
+ };
780
+ /**
781
+ * Fired whenever a comment is added.
782
+ *
783
+ * The event name includes `channelId` so it is possible to listen only
784
+ * on changes happening in the specified channel.
785
+ *
786
+ * It is also possible to listen to events from the given thread ID by appending `:[threadId]` part to the event name
787
+ *
788
+ * ```ts
789
+ * const channelId = 'foo';
790
+ * const threadId = '1234';
791
+ *
792
+ * commentsRepository.on( `addComment:${ channelId }:${ threadId }`, ( evt, data ) => {
793
+ * console.log( evt, data );
794
+ * } );
795
+ * ```
796
+ *
797
+ * @eventName ~CommentsRepository#addComment
798
+ */
799
+ export type AddCommentEvent = {
800
+ name: string;
801
+ args: [CommentEventData];
802
+ };
803
+ /**
804
+ * @param commentId The comment ID.
805
+ * @param authorId ID of the comment author.
806
+ * @param createdAt The comment creation date.
807
+ * @param isFromAdapter A flag describing whether the comment was updated on a remote client (`true`) or a local one (`false`).
808
+ */
809
+ export type CommentData = BaseCommentData & {
810
+ commentId?: string;
811
+ authorId: string;
812
+ createdAt: Date;
813
+ isFromAdapter?: boolean;
814
+ };
815
+ export type CommentEventData = BaseCommentThread & CommentData;
816
+ /**
817
+ * Fired whenever a comment is updated.
818
+ *
819
+ * The event name includes `channelId` so it is possible to listen only
820
+ * to changes happening in the specified channel.
821
+ *
822
+ * It is also possible to listen to events from the given thread ID by appending `:[threadId]` part to the event name
823
+ *
824
+ * ```ts
825
+ * const channelId = 'foo';
826
+ * const threadId = '1234';
827
+ *
828
+ * commentsRepository.on( `updateComment:${ channelId }:${ threadId }`, ( evt, data ) => {
829
+ * console.log( evt, data );
830
+ * } );
831
+ * ```
832
+ *
833
+ * @eventName ~CommentsRepository#updateComment
834
+ */
835
+ export type UpdateCommentEvent = {
836
+ name: string;
837
+ args: [UpdateCommentEventData];
838
+ };
839
+ export type UpdateCommentData = Partial<CommentEventData>;
840
+ export type UpdateCommentEventData = UpdateCommentData & BaseComment;
841
+ /**
842
+ * Fired whenever a comment is removed.
843
+ *
844
+ * The event name includes `channelId` so it is possible to listen only
845
+ * to changes happening in the specified channel.
846
+ *
847
+ * It is also possible to listen to events from the given thread ID by appending `:[threadId]` part to the event name
848
+ *
849
+ * ```ts
850
+ * const channelId = 'foo';
851
+ * const threadId = '1234';
852
+ *
853
+ * commentsRepository.on( `removeComment:${ channelId }:${ threadId }`, ( evt, data ) => {
854
+ * console.log( evt, data );
855
+ * } );
856
+ * ```
857
+ *
858
+ * @eventName ~CommentsRepository#removeComment
859
+ */
860
+ export type RemoveCommentEvent = {
861
+ name: string;
862
+ args: [BaseComment];
863
+ };
864
+ export type CommentDataJSON = Omit<CommentData, 'isFromAdapter'>;
865
+ export type CommentThreadDataJSON = {
866
+ threadId: string;
867
+ context: CommentThreadContext;
868
+ resolvedAt: Date | null;
869
+ resolvedBy: string | null;
870
+ comments: Array<CommentDataJSON>;
871
+ };
872
+ /**
873
+ * Comments adapter.
874
+ *
875
+ * The comments adapter is an object that communicates asynchronously with the data source to fetch or save
876
+ * the comment data. It is used internally by the comments feature whenever a comment is loaded, created or deleted.
877
+ * The adapter is optional. You might need to provide it if you are {@glink features/collaboration/comments/comments-integration
878
+ * using the comments feature without real-time collaboration}.
879
+ * To set the adapter, overwrite the `CommentsRepository#adapter` property.
880
+ */
881
+ export interface CommentsAdapter {
882
+ /**
883
+ * Called whenever a new comment thread is created.
884
+ */
885
+ addCommentThread: (data: Omit<CommentThreadData, 'isFromAdapter'> & {
886
+ comments: Array<CommentDataJSON>;
887
+ }) => Promise<{
888
+ threadId: string;
889
+ comments: Array<{
890
+ commentId: string;
891
+ createdAt: Date;
892
+ }>;
893
+ }>;
894
+ /**
895
+ * Called when the editor needs the data for a comment thread.
896
+ *
897
+ * It should return a promise that resolves with the comment thread data.
898
+ * The resolved data object should also have the `isFromAdapter` property set to `true`.
899
+ *
900
+ * @param data.channelId The ID of the document or context to which the comment is added.
901
+ * @param data.threadId The ID of the comment thread that the comment is added to.
902
+ */
903
+ getCommentThread: (data: Omit<BaseCommentThread, 'isFromAdapter'>) => Promise<{
904
+ threadId: string;
905
+ comments: Array<CommentData>;
906
+ resolvedAt?: Date | null;
907
+ resolvedBy?: string | null;
908
+ attributes: Record<string, unknown>;
909
+ }>;
910
+ /**
911
+ * Called each time the user changes the existing comment thread.
912
+ *
913
+ * It updates the comment data in the database and returns a promise
914
+ * that will be resolved when the update is completed.
915
+ */
916
+ updateCommentThread: (data: Omit<UpdateCommentThreadEventData, 'isFromAdapter'>) => Promise<void>;
917
+ /**
918
+ * Called each time the user resolves a comment thread.
919
+ *
920
+ * @param data.channelId The ID of the document or context that the comment thread is removed from.
921
+ * @param data.threadId The ID of the thread to remove.
922
+ */
923
+ resolveCommentThread: (data: Omit<BaseCommentThread, 'isFromAdapter'>) => Promise<{
924
+ threadId: string;
925
+ resolvedAt: Date;
926
+ resolvedBy: string;
927
+ }>;
928
+ /**
929
+ * Called when the user reopens a resolved comment thread.
930
+ *
931
+ * @param data.channelId The ID of the document or context that the comment thread is removed from.
932
+ * @param data.threadId The ID of the thread to remove.
933
+ */
934
+ reopenCommentThread: (data: Omit<BaseCommentThread, 'isFromAdapter'>) => Promise<void>;
935
+ /**
936
+ * Called each time the user removes a comment thread.
937
+ *
938
+ * Keep in mind that comment thread removal happens only
939
+ * for comment threads created outside of the editor.
940
+ * You do not need to implement this method if you use
941
+ * the comments feature inside the editor only.
942
+ *
943
+ * It should return a promise that resolves when the thread is removed.
944
+ *
945
+ * @param data.channelId The ID of the document or context that the comment thread is removed from.
946
+ * @param data.threadId The ID of the thread to remove.
947
+ */
948
+ removeCommentThread: (data: Omit<BaseCommentThread, 'isFromAdapter'>) => Promise<void>;
949
+ /**
950
+ * Called each time the user adds a new comment to a thread.
951
+ *
952
+ * It saves the comment data in the database and returns a promise
953
+ * that should get resolved when the save is completed.
954
+ *
955
+ * If the promise resolves with an object with the `createdAt` property, the
956
+ * comment property will be updated in the comment in the editor.
957
+ * This is to update the comment data with the server-side information.
958
+ *
959
+ * The `data` object does not expect the `authorId` property.
960
+ * For security reasons, the author of the comment should be set
961
+ * on the server side.
962
+ *
963
+ * The `data` object does not expect the `createdAt` property either.
964
+ * You should use the server-side time generator to ensure that all users
965
+ * see the same date.
966
+ *
967
+ * It is recommended to stringify the `data.attributes` value to JSON
968
+ * and to save it as a string in your database and then to parse the
969
+ * value from JSON when loading comments.
970
+ *
971
+ * @param data.channelId The ID of the document or context to which the comment is added.
972
+ * @param data.threadId The ID of the comment thread that the comment is added to.
973
+ * @param data.commentId The comment ID.
974
+ * @param data.content The comment content.
975
+ * @param data.attributes Comment custom attributes.
976
+ */
977
+ addComment: (data: Omit<BaseComment, 'isFromAdapter'> & BaseCommentData) => Promise<{
978
+ commentId: string;
979
+ createdAt: Date;
980
+ }>;
981
+ /**
982
+ * Called each time the user changes the existing comment.
983
+ *
984
+ * It updates the comment data in the database and returns a promise
985
+ * that will be resolved when the update is completed.
986
+ *
987
+ * Keep in mind that the `data` parameter only contains the
988
+ * properties of a comment that have changed.
989
+ *
990
+ * @param data.channelId The ID of the document or context where the comment is updated.
991
+ * @param data.threadId The ID of the comment thread where the comment is updated.
992
+ * @param data.commentId The ID of the comment to update.
993
+ * @param data.content The new content of the comment.
994
+ * @param data.attributes Custom comment attributes.
995
+ */
996
+ updateComment: (data: Omit<BaseComment, 'isFromAdapter'> & Partial<BaseCommentData>) => Promise<void>;
997
+ /**
998
+ * Called each time the user removes a comment from the thread.
999
+ *
1000
+ * It removes the comment from the database and returns a promise
1001
+ * that will be resolved when the removal is completed.
1002
+ *
1003
+ * @param data.channelId The ID of the document or context that the comment is removed from.
1004
+ * @param data.threadId The ID of the comment thread that the comment is removed from.
1005
+ * @param data.commentId The ID of the comment to remove.
1006
+ */
1007
+ removeComment: (data: Omit<BaseComment, 'isFromAdapter'>) => Promise<void>;
1008
+ }
1009
+ export {};