@ckeditor/ckeditor5-track-changes 39.0.2 → 40.0.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 (136) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +1 -1
  3. package/build/track-changes.js +1 -1
  4. package/package.json +3 -3
  5. package/src/augmentation.d.ts +40 -40
  6. package/src/commands/acceptsuggestioncommand.d.ts +24 -24
  7. package/src/commands/acceptsuggestioncommand.js +1 -1
  8. package/src/commands/discardsuggestioncommand.d.ts +24 -24
  9. package/src/commands/discardsuggestioncommand.js +1 -1
  10. package/src/commands/executeonallsuggestionscommand.d.ts +24 -24
  11. package/src/commands/executeonallsuggestionscommand.js +1 -1
  12. package/src/commands/executeonselectedsuggestionscommand.d.ts +24 -24
  13. package/src/commands/executeonselectedsuggestionscommand.js +1 -1
  14. package/src/commands/trackchangescommand.d.ts +26 -26
  15. package/src/commands/trackchangescommand.js +1 -1
  16. package/src/index.d.ts +16 -16
  17. package/src/integrations/aiassistant.d.ts +17 -0
  18. package/src/integrations/aiassistant.js +23 -0
  19. package/src/integrations/alignment.d.ts +17 -17
  20. package/src/integrations/alignment.js +1 -1
  21. package/src/integrations/basicstyles.d.ts +17 -17
  22. package/src/integrations/basicstyles.js +1 -1
  23. package/src/integrations/blockquote.d.ts +17 -17
  24. package/src/integrations/blockquote.js +1 -1
  25. package/src/integrations/ckbox.d.ts +17 -17
  26. package/src/integrations/ckbox.js +1 -1
  27. package/src/integrations/codeblock.d.ts +17 -17
  28. package/src/integrations/codeblock.js +1 -1
  29. package/src/integrations/comments.d.ts +14 -14
  30. package/src/integrations/comments.js +1 -1
  31. package/src/integrations/deletecommand.d.ts +17 -17
  32. package/src/integrations/deletecommand.js +1 -1
  33. package/src/integrations/documentlist.d.ts +17 -17
  34. package/src/integrations/documentlist.js +1 -1
  35. package/src/integrations/documentlistproperties.d.ts +29 -29
  36. package/src/integrations/documentlistproperties.js +1 -1
  37. package/src/integrations/entercommand.d.ts +16 -16
  38. package/src/integrations/entercommand.js +1 -1
  39. package/src/integrations/findandreplace.d.ts +21 -21
  40. package/src/integrations/findandreplace.js +1 -1
  41. package/src/integrations/font.d.ts +17 -17
  42. package/src/integrations/font.js +1 -1
  43. package/src/integrations/formatpainter.d.ts +17 -17
  44. package/src/integrations/formatpainter.js +1 -1
  45. package/src/integrations/heading.d.ts +17 -17
  46. package/src/integrations/heading.js +1 -1
  47. package/src/integrations/highlight.d.ts +17 -17
  48. package/src/integrations/highlight.js +1 -1
  49. package/src/integrations/horizontalline.d.ts +17 -17
  50. package/src/integrations/horizontalline.js +1 -1
  51. package/src/integrations/htmlembed.d.ts +17 -17
  52. package/src/integrations/htmlembed.js +1 -1
  53. package/src/integrations/image.d.ts +17 -17
  54. package/src/integrations/image.js +1 -1
  55. package/src/integrations/imagereplace.d.ts +23 -23
  56. package/src/integrations/imagereplace.js +1 -1
  57. package/src/integrations/importword.d.ts +18 -18
  58. package/src/integrations/importword.js +1 -1
  59. package/src/integrations/indent.d.ts +17 -17
  60. package/src/integrations/indent.js +1 -1
  61. package/src/integrations/inputcommand.d.ts +16 -16
  62. package/src/integrations/inputcommand.js +1 -1
  63. package/src/integrations/link.d.ts +17 -17
  64. package/src/integrations/link.js +1 -1
  65. package/src/integrations/list.d.ts +17 -17
  66. package/src/integrations/list.js +1 -1
  67. package/src/integrations/listproperties.d.ts +29 -29
  68. package/src/integrations/listproperties.js +1 -1
  69. package/src/integrations/mediaembed.d.ts +17 -17
  70. package/src/integrations/mediaembed.js +1 -1
  71. package/src/integrations/mention.d.ts +17 -17
  72. package/src/integrations/mention.js +1 -1
  73. package/src/integrations/pagebreak.d.ts +17 -17
  74. package/src/integrations/pagebreak.js +1 -1
  75. package/src/integrations/paragraph.d.ts +17 -17
  76. package/src/integrations/paragraph.js +1 -1
  77. package/src/integrations/removeformat.d.ts +17 -17
  78. package/src/integrations/removeformat.js +1 -1
  79. package/src/integrations/restrictededitingmode.d.ts +17 -17
  80. package/src/integrations/restrictededitingmode.js +1 -1
  81. package/src/integrations/shiftentercommand.d.ts +16 -16
  82. package/src/integrations/shiftentercommand.js +1 -1
  83. package/src/integrations/standardeditingmode.d.ts +17 -17
  84. package/src/integrations/standardeditingmode.js +1 -1
  85. package/src/integrations/style.d.ts +18 -18
  86. package/src/integrations/style.js +1 -1
  87. package/src/integrations/table.d.ts +42 -42
  88. package/src/integrations/table.js +1 -1
  89. package/src/integrations/tablecaption.d.ts +22 -22
  90. package/src/integrations/tablecaption.js +1 -1
  91. package/src/integrations/tableclipboard.d.ts +19 -19
  92. package/src/integrations/tableclipboard.js +1 -1
  93. package/src/integrations/tablecolumnresize.d.ts +26 -26
  94. package/src/integrations/tablecolumnresize.js +1 -1
  95. package/src/integrations/tableheadings.d.ts +22 -22
  96. package/src/integrations/tableheadings.js +1 -1
  97. package/src/integrations/tablemergesplit.d.ts +22 -22
  98. package/src/integrations/tablemergesplit.js +1 -1
  99. package/src/integrations/tableofcontents.d.ts +17 -17
  100. package/src/integrations/tableofcontents.js +1 -1
  101. package/src/integrations/tableproperties.d.ts +27 -27
  102. package/src/integrations/tableproperties.js +1 -1
  103. package/src/integrations/template.d.ts +17 -17
  104. package/src/integrations/template.js +1 -1
  105. package/src/integrations/title.d.ts +17 -17
  106. package/src/integrations/title.js +1 -1
  107. package/src/integrations/undo.d.ts +17 -17
  108. package/src/integrations/undo.js +1 -1
  109. package/src/integrations/utils.d.ts +21 -21
  110. package/src/integrations/utils.js +1 -1
  111. package/src/suggestion.d.ts +276 -276
  112. package/src/suggestion.js +1 -1
  113. package/src/suggestiondescriptionfactory.d.ts +163 -163
  114. package/src/suggestiondescriptionfactory.js +1 -1
  115. package/src/trackchanges.d.ts +244 -244
  116. package/src/trackchanges.js +1 -1
  117. package/src/trackchangesconfig.d.ts +75 -75
  118. package/src/trackchangesdata.d.ts +41 -41
  119. package/src/trackchangesdata.js +1 -1
  120. package/src/trackchangesediting.d.ts +468 -467
  121. package/src/trackchangesediting.js +1 -1
  122. package/src/trackchangesui.d.ts +38 -38
  123. package/src/trackchangesui.js +1 -1
  124. package/src/ui/suggestioncontroller.d.ts +37 -37
  125. package/src/ui/suggestioncontroller.js +1 -1
  126. package/src/ui/view/basesuggestionthreadview.d.ts +170 -170
  127. package/src/ui/view/basesuggestionthreadview.js +1 -1
  128. package/src/ui/view/suggestionthreadview.d.ts +182 -182
  129. package/src/ui/view/suggestionthreadview.js +1 -1
  130. package/src/utils/common-translations.d.ts +9 -9
  131. package/src/utils/common-translations.js +1 -1
  132. package/src/utils/utils.d.ts +30 -30
  133. package/src/utils/utils.js +1 -1
  134. package/theme/icons/track-changes-accept.svg +1 -1
  135. package/theme/icons/track-changes-discard.svg +1 -1
  136. package/theme/icons/track-changes.svg +1 -1
@@ -1,276 +1,276 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module track-changes/suggestion
7
- * @publicApi
8
- */
9
- import { Element, type Marker, type Model, type Range, type Item } from 'ckeditor5/src/engine';
10
- import type { User } from 'ckeditor5-collaboration/src/collaboration-core';
11
- import type { CommentThread } from '@ckeditor/ckeditor5-comments';
12
- import type { FormatData } from './trackchangesediting';
13
- declare const Suggestion_base: {
14
- new (): import("ckeditor5/src/utils").Observable;
15
- prototype: import("ckeditor5/src/utils").Observable; /**
16
- * Previous suggestion in suggestions chain.
17
- *
18
- * Chained suggestions should be handled as one entity.
19
- *
20
- * @observable
21
- */
22
- };
23
- /**
24
- * Represents a singular suggestion that is tracked by track changes plugin.
25
- *
26
- * `Suggestion` instances are created and handled by {@link module:track-changes/trackchanges~TrackChanges track changes plugin}.
27
- */
28
- export default class Suggestion extends Suggestion_base {
29
- /**
30
- * Suggestion ID.
31
- */
32
- readonly id: string;
33
- /**
34
- * Suggestion type.
35
- */
36
- type: SuggestionType;
37
- /**
38
- * Suggestion sub-type.
39
- *
40
- * This is an additional identifier for suggestions. Two suggestions of the same type may have different sub-types to differentiate
41
- * suggestions behavior and handle interactions between suggestions.
42
- *
43
- * Sub-type is used for:
44
- *
45
- * * suggestions joining (only suggestions with the same sub-type can be joined),
46
- * * suggestions custom callbacks (fired when adding, deleting and joining suggestions).
47
- */
48
- subType: string | null;
49
- /**
50
- * The author of the change marked by the suggestion.
51
- */
52
- author: User;
53
- /**
54
- * The user which saved the suggestion data in the database.
55
- *
56
- * Usually the same as author but may be different in some cases (e.g. when suggestion was added from an external source).
57
- */
58
- creator: User;
59
- /**
60
- * The flag indicating whether the suggestion comes from an external source.
61
- */
62
- isExternal: boolean;
63
- /**
64
- * Additional suggestion data.
65
- */
66
- data: FormatData | null;
67
- /**
68
- * Date when the suggestion was saved in the database.
69
- */
70
- createdAt: Date | null;
71
- /**
72
- * Date when the change marked by the suggestion was made.
73
- *
74
- * Usually the same as {@link #createdAt `createdAt`} but may be different in some cases
75
- * (e.g. when suggestion was added from an external source).
76
- *
77
- * @observable
78
- */
79
- authoredAt: Date | null;
80
- /**
81
- * Custom suggestion attributes. See also {@link #setAttribute} and {@link #removeAttribute}.
82
- *
83
- * @observable
84
- */
85
- attributes: {
86
- [k: string]: unknown;
87
- };
88
- /**
89
- * Previous suggestion in suggestions chain.
90
- *
91
- * Chained suggestions should be handled as one entity.
92
- *
93
- * @observable
94
- */
95
- previous: Suggestion | null;
96
- /**
97
- * Next suggestion in suggestions chain.
98
- *
99
- * Chained suggestions should be handled as one entity.
100
- *
101
- * @observable
102
- */
103
- next: Suggestion | null;
104
- /**
105
- * Comment thread model for comments added to this suggestion.
106
- *
107
- * @observable
108
- */
109
- commentThread: CommentThread | null;
110
- constructor(model: Model, options: SuggestionOptions);
111
- /**
112
- * The first (most-previous) suggestion in this suggestion chain.
113
- */
114
- get head(): Suggestion;
115
- /**
116
- * Informs whether suggestion has at least one comment.
117
- */
118
- get hasComments(): boolean;
119
- /**
120
- * Informs whether the suggestion is a multi-range suggestion or a single-range suggestion.
121
- *
122
- * This is evaluated basing on the marker name belonging to this suggestion.
123
- * Even if only one marker belongs to the suggestion at a given time it can still be a multi range suggestion.
124
- */
125
- get isMultiRange(): boolean;
126
- /**
127
- * Informs whether the suggestion is still in the editor content.
128
- *
129
- * Returns `true` if there is at least one marker suggestion in the editor content.
130
- */
131
- get isInContent(): boolean;
132
- /**
133
- * Binds given marker name to this suggestion.
134
- */
135
- addMarkerName(markerName: string): void;
136
- /**
137
- * Returns all names of markers belonging to this suggestion.
138
- */
139
- getMarkerNames(): Array<string>;
140
- /**
141
- * Returns all markers belonging to this suggestion.
142
- */
143
- getMarkers(): Array<Marker>;
144
- /**
145
- * Returns the first marker belonging to this suggestion, i.e the first marker that was added to this suggestion
146
- * and not removed yet.
147
- *
148
- * This method is useful if you know that the suggestion has only one marker and want to process it.
149
- */
150
- getFirstMarker(): Marker | null;
151
- /**
152
- * Removes all markers from the suggestion and the editor content.
153
- */
154
- removeMarkers(): void;
155
- /**
156
- * Removes marker with the given name from the suggestion and the editor content.
157
- */
158
- removeMarker(markerName: string): void;
159
- /**
160
- * Adds a new range to this suggestion. It is assumed that the suggestion is a multi-range suggestion.
161
- *
162
- * A marker name is generated from this suggestion's properties and a marker with that name is created and set to a given `range`.
163
- */
164
- addRange(range: Range): void;
165
- /**
166
- * Checks if given `range` is intersecting with any of the ranges of markers belonging to this suggestion.
167
- */
168
- isIntersectingWithRange(range: Range): boolean;
169
- /**
170
- * Returns all ranges of all markers belonging to this suggestion.
171
- */
172
- getRanges(): Array<Range>;
173
- /**
174
- * Returns all {@link module:engine/model/item~Item model items} that are in this suggestion.
175
- */
176
- getItems(): Array<Item>;
177
- /**
178
- * Returns the first range belonging to this suggestion, i.e. the range of the first marker that was added to
179
- * this suggestion and not removed yet.
180
- *
181
- * This method is useful if you know that the suggestion has only one marker and want to process its range.
182
- */
183
- getFirstRange(): Range | null;
184
- /**
185
- * Returns the model element contained in the suggestion.
186
- *
187
- * A {@link module:engine/model/element~Element model element} is considered as contained if there is exactly
188
- * one range in the suggestion, and that range contains exactly one element.
189
- *
190
- * Returns `null` if there is no contained element.
191
- */
192
- getContainedElement(): Element | null;
193
- /**
194
- * Accepts the suggestion.
195
- */
196
- accept(): void;
197
- /**
198
- * Discards the suggestion.
199
- */
200
- discard(): void;
201
- /**
202
- * Returns all suggestions that are in this suggestion chain.
203
- */
204
- getAllAdjacentSuggestions(): Array<Suggestion>;
205
- /**
206
- * Adds suggestion attribute.
207
- *
208
- * Suggestion attributes are custom data that can be set and used by features
209
- * built around suggestions. Use it to store your feature data with other suggestion data.
210
- *
211
- * ```ts
212
- * suggestion.setAttribute( 'isImportant', true );
213
- * ```
214
- *
215
- * You can group multiple values in an object, using dot notation:
216
- *
217
- * ```ts
218
- * suggestion.setAttribute( 'customData.type', 'image' );
219
- * suggestion.setAttribute( 'customData.src', 'foo.jpg' );
220
- * ```
221
- *
222
- * Attributes set on the suggestion can be accessed through `attribute` property:
223
- *
224
- * ```ts
225
- * const isImportant = suggestion.attributes.isImportant;
226
- * const type = suggestion.attributes.customData.type;
227
- * ```
228
- *
229
- * You can also observe `attributes` property or bind other properties to it:
230
- *
231
- * ```ts
232
- * myObj.bind( 'customData' ).to( suggestion, 'attributes', attributes => attributes.customData );
233
- * ```
234
- *
235
- * Whenever `setAttribute()` or `removeAttribute()` is called, `attributes` property
236
- * is re-set and observables are refreshed.
237
- */
238
- setAttribute(name: string, value: unknown): void;
239
- /**
240
- * Removes suggestion attribute.
241
- *
242
- * See also {@link #setAttribute}
243
- */
244
- removeAttribute(name: string): void;
245
- toJSON(): SuggestionJSON;
246
- /**
247
- * Returns a random string that can be used as additional identifier for the marker name for suggestions that are multi range.
248
- */
249
- static getMultiRangeId(): string;
250
- }
251
- export interface SuggestionOptions {
252
- id: string;
253
- type: SuggestionType;
254
- subType: string | null;
255
- attributes: {
256
- [k: string]: unknown;
257
- };
258
- author: User;
259
- creator: User;
260
- onAccept: Function;
261
- onDiscard: Function;
262
- onAttributesChange: Function;
263
- }
264
- export interface SuggestionJSON {
265
- id: string;
266
- type: string;
267
- authorId: string;
268
- createdAt: Date | null;
269
- hasComments?: boolean;
270
- data?: FormatData | null;
271
- attributes: {
272
- [k: string]: unknown;
273
- };
274
- }
275
- export type SuggestionType = 'insertion' | 'deletion' | 'formatInline' | 'formatBlock';
276
- export {};
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module track-changes/suggestion
7
+ * @publicApi
8
+ */
9
+ import { Element, type Marker, type Model, type Range, type Item } from 'ckeditor5/src/engine';
10
+ import type { User } from 'ckeditor5-collaboration/src/collaboration-core';
11
+ import type { CommentThread } from '@ckeditor/ckeditor5-comments';
12
+ import type { FormatData } from './trackchangesediting';
13
+ declare const Suggestion_base: {
14
+ new (): import("ckeditor5/src/utils").Observable;
15
+ prototype: import("ckeditor5/src/utils").Observable; /**
16
+ * Previous suggestion in suggestions chain.
17
+ *
18
+ * Chained suggestions should be handled as one entity.
19
+ *
20
+ * @observable
21
+ */
22
+ };
23
+ /**
24
+ * Represents a singular suggestion that is tracked by track changes plugin.
25
+ *
26
+ * `Suggestion` instances are created and handled by {@link module:track-changes/trackchanges~TrackChanges track changes plugin}.
27
+ */
28
+ export default class Suggestion extends Suggestion_base {
29
+ /**
30
+ * Suggestion ID.
31
+ */
32
+ readonly id: string;
33
+ /**
34
+ * Suggestion type.
35
+ */
36
+ type: SuggestionType;
37
+ /**
38
+ * Suggestion sub-type.
39
+ *
40
+ * This is an additional identifier for suggestions. Two suggestions of the same type may have different sub-types to differentiate
41
+ * suggestions behavior and handle interactions between suggestions.
42
+ *
43
+ * Sub-type is used for:
44
+ *
45
+ * * suggestions joining (only suggestions with the same sub-type can be joined),
46
+ * * suggestions custom callbacks (fired when adding, deleting and joining suggestions).
47
+ */
48
+ subType: string | null;
49
+ /**
50
+ * The author of the change marked by the suggestion.
51
+ */
52
+ author: User;
53
+ /**
54
+ * The user which saved the suggestion data in the database.
55
+ *
56
+ * Usually the same as author but may be different in some cases (e.g. when suggestion was added from an external source).
57
+ */
58
+ creator: User;
59
+ /**
60
+ * The flag indicating whether the suggestion comes from an external source.
61
+ */
62
+ isExternal: boolean;
63
+ /**
64
+ * Additional suggestion data.
65
+ */
66
+ data: FormatData | null;
67
+ /**
68
+ * Date when the suggestion was saved in the database.
69
+ */
70
+ createdAt: Date | null;
71
+ /**
72
+ * Date when the change marked by the suggestion was made.
73
+ *
74
+ * Usually the same as {@link #createdAt `createdAt`} but may be different in some cases
75
+ * (e.g. when suggestion was added from an external source).
76
+ *
77
+ * @observable
78
+ */
79
+ authoredAt: Date | null;
80
+ /**
81
+ * Custom suggestion attributes. See also {@link #setAttribute} and {@link #removeAttribute}.
82
+ *
83
+ * @observable
84
+ */
85
+ attributes: {
86
+ [k: string]: unknown;
87
+ };
88
+ /**
89
+ * Previous suggestion in suggestions chain.
90
+ *
91
+ * Chained suggestions should be handled as one entity.
92
+ *
93
+ * @observable
94
+ */
95
+ previous: Suggestion | null;
96
+ /**
97
+ * Next suggestion in suggestions chain.
98
+ *
99
+ * Chained suggestions should be handled as one entity.
100
+ *
101
+ * @observable
102
+ */
103
+ next: Suggestion | null;
104
+ /**
105
+ * Comment thread model for comments added to this suggestion.
106
+ *
107
+ * @observable
108
+ */
109
+ commentThread: CommentThread | null;
110
+ constructor(model: Model, options: SuggestionOptions);
111
+ /**
112
+ * The first (most-previous) suggestion in this suggestion chain.
113
+ */
114
+ get head(): Suggestion;
115
+ /**
116
+ * Informs whether suggestion has at least one comment.
117
+ */
118
+ get hasComments(): boolean;
119
+ /**
120
+ * Informs whether the suggestion is a multi-range suggestion or a single-range suggestion.
121
+ *
122
+ * This is evaluated basing on the marker name belonging to this suggestion.
123
+ * Even if only one marker belongs to the suggestion at a given time it can still be a multi range suggestion.
124
+ */
125
+ get isMultiRange(): boolean;
126
+ /**
127
+ * Informs whether the suggestion is still in the editor content.
128
+ *
129
+ * Returns `true` if there is at least one marker suggestion in the editor content.
130
+ */
131
+ get isInContent(): boolean;
132
+ /**
133
+ * Binds given marker name to this suggestion.
134
+ */
135
+ addMarkerName(markerName: string): void;
136
+ /**
137
+ * Returns all names of markers belonging to this suggestion.
138
+ */
139
+ getMarkerNames(): Array<string>;
140
+ /**
141
+ * Returns all markers belonging to this suggestion.
142
+ */
143
+ getMarkers(): Array<Marker>;
144
+ /**
145
+ * Returns the first marker belonging to this suggestion, i.e the first marker that was added to this suggestion
146
+ * and not removed yet.
147
+ *
148
+ * This method is useful if you know that the suggestion has only one marker and want to process it.
149
+ */
150
+ getFirstMarker(): Marker | null;
151
+ /**
152
+ * Removes all markers from the suggestion and the editor content.
153
+ */
154
+ removeMarkers(): void;
155
+ /**
156
+ * Removes marker with the given name from the suggestion and the editor content.
157
+ */
158
+ removeMarker(markerName: string): void;
159
+ /**
160
+ * Adds a new range to this suggestion. It is assumed that the suggestion is a multi-range suggestion.
161
+ *
162
+ * A marker name is generated from this suggestion's properties and a marker with that name is created and set to a given `range`.
163
+ */
164
+ addRange(range: Range): void;
165
+ /**
166
+ * Checks if given `range` is intersecting with any of the ranges of markers belonging to this suggestion.
167
+ */
168
+ isIntersectingWithRange(range: Range): boolean;
169
+ /**
170
+ * Returns all ranges of all markers belonging to this suggestion.
171
+ */
172
+ getRanges(): Array<Range>;
173
+ /**
174
+ * Returns all {@link module:engine/model/item~Item model items} that are in this suggestion.
175
+ */
176
+ getItems(): Array<Item>;
177
+ /**
178
+ * Returns the first range belonging to this suggestion, i.e. the range of the first marker that was added to
179
+ * this suggestion and not removed yet.
180
+ *
181
+ * This method is useful if you know that the suggestion has only one marker and want to process its range.
182
+ */
183
+ getFirstRange(): Range | null;
184
+ /**
185
+ * Returns the model element contained in the suggestion.
186
+ *
187
+ * A {@link module:engine/model/element~Element model element} is considered as contained if there is exactly
188
+ * one range in the suggestion, and that range contains exactly one element.
189
+ *
190
+ * Returns `null` if there is no contained element.
191
+ */
192
+ getContainedElement(): Element | null;
193
+ /**
194
+ * Accepts the suggestion.
195
+ */
196
+ accept(): void;
197
+ /**
198
+ * Discards the suggestion.
199
+ */
200
+ discard(): void;
201
+ /**
202
+ * Returns all suggestions that are in this suggestion chain.
203
+ */
204
+ getAllAdjacentSuggestions(): Array<Suggestion>;
205
+ /**
206
+ * Adds suggestion attribute.
207
+ *
208
+ * Suggestion attributes are custom data that can be set and used by features
209
+ * built around suggestions. Use it to store your feature data with other suggestion data.
210
+ *
211
+ * ```ts
212
+ * suggestion.setAttribute( 'isImportant', true );
213
+ * ```
214
+ *
215
+ * You can group multiple values in an object, using dot notation:
216
+ *
217
+ * ```ts
218
+ * suggestion.setAttribute( 'customData.type', 'image' );
219
+ * suggestion.setAttribute( 'customData.src', 'foo.jpg' );
220
+ * ```
221
+ *
222
+ * Attributes set on the suggestion can be accessed through `attribute` property:
223
+ *
224
+ * ```ts
225
+ * const isImportant = suggestion.attributes.isImportant;
226
+ * const type = suggestion.attributes.customData.type;
227
+ * ```
228
+ *
229
+ * You can also observe `attributes` property or bind other properties to it:
230
+ *
231
+ * ```ts
232
+ * myObj.bind( 'customData' ).to( suggestion, 'attributes', attributes => attributes.customData );
233
+ * ```
234
+ *
235
+ * Whenever `setAttribute()` or `removeAttribute()` is called, `attributes` property
236
+ * is re-set and observables are refreshed.
237
+ */
238
+ setAttribute(name: string, value: unknown): void;
239
+ /**
240
+ * Removes suggestion attribute.
241
+ *
242
+ * See also {@link #setAttribute}
243
+ */
244
+ removeAttribute(name: string): void;
245
+ toJSON(): SuggestionJSON;
246
+ /**
247
+ * Returns a random string that can be used as additional identifier for the marker name for suggestions that are multi range.
248
+ */
249
+ static getMultiRangeId(): string;
250
+ }
251
+ export interface SuggestionOptions {
252
+ id: string;
253
+ type: SuggestionType;
254
+ subType: string | null;
255
+ attributes: {
256
+ [k: string]: unknown;
257
+ };
258
+ author: User;
259
+ creator: User;
260
+ onAccept: Function;
261
+ onDiscard: Function;
262
+ onAttributesChange: Function;
263
+ }
264
+ export interface SuggestionJSON {
265
+ id: string;
266
+ type: string;
267
+ authorId: string;
268
+ createdAt: Date | null;
269
+ hasComments?: boolean;
270
+ data?: FormatData | null;
271
+ attributes: {
272
+ [k: string]: unknown;
273
+ };
274
+ }
275
+ export type SuggestionType = 'insertion' | 'deletion' | 'formatInline' | 'formatBlock';
276
+ export {};
package/src/suggestion.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x25f9=['author','nodeAfter','get','_markerNames','createdAt','authoredAt','attributes','toJSON','hasComments','getMarkers','next','length','getRange','creator','commentThread','map','onAttributesChange','previous','discard','getContainedElement','end','set','_isDataLoaded','onDiscard','split','head','delete','getItems','addMarkerName','isIntersecting','_saved','reduce','addRange','getMultiRangeId','data','_model','setAttribute','add','isExternal','change','from','nodeBefore','removeAttribute','substr','decorate','getFirstMarker','type','accept','_onAccept','removeMarker','getMarkerNames','clear','subType','isIntersectingWithRange','size','getAllAdjacentSuggestions','markers','@external','removeMarkers','_onDiscard','filter','_onAttributesChange','getRanges'];(function(_0x3d4d1d,_0x25f9dd){const _0x2bafac=function(_0xbb8e1c){while(--_0xbb8e1c){_0x3d4d1d['push'](_0x3d4d1d['shift']());}};_0x2bafac(++_0x25f9dd);}(_0x25f9,0x165));const _0x2baf=function(_0x3d4d1d,_0x25f9dd){_0x3d4d1d=_0x3d4d1d-0x0;let _0x2bafac=_0x25f9[_0x3d4d1d];return _0x2bafac;};import{Element as _0x194ccb}from'ckeditor5/src/engine';import{ObservableMixin as _0x411fc0,uid as _0xd8f5c4}from'ckeditor5/src/utils';import{cloneDeep as _0x2c855c,isEqual as _0x59a9e2,set as _0x547294,unset as _0x3164c1}from'lodash-es';export default class u extends _0x411fc0(){constructor(_0x4a9210,_0x19e273){super(),this[_0x2baf('0x2b')]=!0x1,this['id']=_0x19e273['id'],this[_0x2baf('0x4')]=_0x19e273[_0x2baf('0x4')],this['subType']=_0x19e273[_0x2baf('0xa')]||null,this[_0x2baf('0x15')]=_0x19e273[_0x2baf('0x15')],this['creator']=_0x19e273[_0x2baf('0x22')]||_0x19e273['author'],this[_0x2baf('0x3b')]=Boolean(_0x19e273[_0x2baf('0x1b')]&&_0x19e273[_0x2baf('0x1b')][_0x2baf('0xf')]),this[_0x2baf('0x37')]=null,this[_0x2baf('0x38')]=_0x4a9210,this[_0x2baf('0x6')]=_0x19e273['onAccept'],this[_0x2baf('0x11')]=_0x19e273[_0x2baf('0x2c')],this[_0x2baf('0x13')]=_0x19e273[_0x2baf('0x25')],this[_0x2baf('0x18')]=new Set(),this[_0x2baf('0x19')]=null,this[_0x2baf('0x2a')](_0x2baf('0x1a'),null),this[_0x2baf('0x2a')]('attributes',_0x19e273[_0x2baf('0x1b')]||{}),this[_0x2baf('0x2a')]('previous',null),this[_0x2baf('0x2a')](_0x2baf('0x1f'),null),this[_0x2baf('0x2a')](_0x2baf('0x23'),null),this['set'](_0x2baf('0x33'),!0x1),this[_0x2baf('0x2')](_0x2baf('0x5')),this[_0x2baf('0x2')](_0x2baf('0x27'));}get[_0x2baf('0x2e')](){let _0x979603=this;for(;_0x979603[_0x2baf('0x26')];)_0x979603=_0x979603[_0x2baf('0x26')];return _0x979603;}get[_0x2baf('0x1d')](){return!!this[_0x2baf('0x23')]&&this[_0x2baf('0x23')][_0x2baf('0x20')]>0x0;}get['isMultiRange'](){if(0x0==this[_0x2baf('0x18')][_0x2baf('0xc')])return!0x1;return 0x6==Array['from'](this[_0x2baf('0x18')])[0x0][_0x2baf('0x2d')](':')[_0x2baf('0x20')];}get['isInContent'](){return null!==this['getFirstMarker']();}[_0x2baf('0x31')](_0x3b2c78){this[_0x2baf('0x18')][_0x2baf('0x3a')](_0x3b2c78);}[_0x2baf('0x8')](){return Array[_0x2baf('0x3d')](this[_0x2baf('0x18')]);}['getMarkers'](){return this[_0x2baf('0x8')]()[_0x2baf('0x24')](_0x5e4dda=>this[_0x2baf('0x38')][_0x2baf('0xe')][_0x2baf('0x17')](_0x5e4dda))[_0x2baf('0x12')](_0xe1c696=>_0xe1c696);}[_0x2baf('0x3')](){return this[_0x2baf('0x1e')]()[0x0]||null;}[_0x2baf('0x10')](){this[_0x2baf('0x38')][_0x2baf('0x3c')](_0x178c42=>{for(const _0x4716f4 of this['getMarkers']())_0x178c42[_0x2baf('0x7')](_0x4716f4);}),this[_0x2baf('0x18')][_0x2baf('0x9')]();}[_0x2baf('0x7')](_0x5437ea){this[_0x2baf('0x38')][_0x2baf('0x3c')](_0x10e6dd=>{_0x10e6dd[_0x2baf('0x7')](_0x5437ea);}),this[_0x2baf('0x18')][_0x2baf('0x2f')](_0x5437ea);}[_0x2baf('0x35')](_0xf401e7){const _0x39c097='suggestion:'+this[_0x2baf('0x4')]+':'+this['subType']+':'+this['id']+':'+this[_0x2baf('0x22')]['id']+':'+u[_0x2baf('0x36')]();this[_0x2baf('0x31')](_0x39c097),this['_model'][_0x2baf('0x3c')](_0x2aae07=>{_0x2aae07['addMarker'](_0x39c097,{'range':_0xf401e7,'usingOperation':!0x0,'affectsData':!0x0});});}[_0x2baf('0xb')](_0x29f23a){for(const _0x1bbbf2 of this[_0x2baf('0x14')]())if(_0x1bbbf2[_0x2baf('0x32')](_0x29f23a))return!0x0;return!0x1;}[_0x2baf('0x14')](){return this[_0x2baf('0x1e')]()[_0x2baf('0x24')](_0x47504d=>_0x47504d[_0x2baf('0x21')]());}[_0x2baf('0x30')](){return this[_0x2baf('0x14')]()[_0x2baf('0x34')]((_0x4f2ae9,_0xf4ba7f)=>[..._0x4f2ae9,..._0xf4ba7f[_0x2baf('0x30')]()],[]);}['getFirstRange'](){var _0x5ba773;return(null===(_0x5ba773=this['getFirstMarker']())||void 0x0===_0x5ba773?void 0x0:_0x5ba773[_0x2baf('0x21')]())||null;}[_0x2baf('0x28')](){const _0x3d5eee=this[_0x2baf('0x14')]();if(0x1!=_0x3d5eee[_0x2baf('0x20')])return null;const _0x1615e4=_0x3d5eee[0x0],_0x39c5d0=_0x1615e4['start'][_0x2baf('0x16')],_0x567d71=_0x1615e4[_0x2baf('0x29')][_0x2baf('0x3e')];return _0x39c5d0 instanceof _0x194ccb?_0x39c5d0!=_0x567d71?null:_0x39c5d0:null;}['accept'](){this[_0x2baf('0x6')](this['getRanges'](),this[_0x2baf('0x37')],this[_0x2baf('0x1b')]),this['removeMarkers']();}[_0x2baf('0x27')](){this['_onDiscard'](this[_0x2baf('0x14')](),this['data'],this[_0x2baf('0x1b')]),this['removeMarkers']();}[_0x2baf('0xd')](){const _0x13f31c=[];let _0x428e13=this[_0x2baf('0x2e')];for(;_0x428e13;)_0x13f31c['push'](_0x428e13),_0x428e13=_0x428e13[_0x2baf('0x1f')];return _0x13f31c;}[_0x2baf('0x39')](_0x5944aa,_0xcfdb20){const _0x3bbaf6=_0x2c855c(this['attributes']);_0x547294(_0x3bbaf6,_0x5944aa,_0xcfdb20),_0x59a9e2(_0x3bbaf6,this[_0x2baf('0x1b')])||(this[_0x2baf('0x1b')]=_0x3bbaf6,this['_onAttributesChange'](_0x3bbaf6));}[_0x2baf('0x0')](_0x33f811){const _0x309a9e=_0x2c855c(this['attributes']);_0x3164c1(_0x309a9e,_0x33f811),_0x59a9e2(_0x309a9e,this[_0x2baf('0x1b')])||(this[_0x2baf('0x1b')]=_0x309a9e,this[_0x2baf('0x13')](this['attributes']));}[_0x2baf('0x1c')](){return{'id':this['id'],'type':this[_0x2baf('0xa')]?this[_0x2baf('0x4')]+':'+this[_0x2baf('0xa')]:this[_0x2baf('0x4')],'authorId':this[_0x2baf('0x22')]['id'],'createdAt':this['createdAt'],'hasComments':this[_0x2baf('0x1d')],'data':this[_0x2baf('0x37')],'attributes':this['attributes']};}static[_0x2baf('0x36')](){return _0xd8f5c4()[_0x2baf('0x1')](0x1,0x5);}}
23
+ const _0x2fe3=['hasComments','isExternal','addMarkerName','commentThread','end','toJSON','suggestion:','getMarkers','attributes','_saved','start','authoredAt','getMarkerNames','delete','substr','data','createdAt','head','clear','accept','getRange','onAttributesChange','type','from','decorate','addRange','change','getRanges','removeMarker','reduce','_isDataLoaded','previous','markers','setAttribute','add','_onAttributesChange','next','_onAccept','subType','removeMarkers','nodeBefore','isInContent','size','discard','length','isIntersecting','getMultiRangeId','creator','_onDiscard','@external','get','_markerNames','removeAttribute','set','getFirstRange','_model','map','getItems','getFirstMarker','onDiscard','author'];(function(_0x26f5d3,_0x2fe393){const _0x4885cd=function(_0x368919){while(--_0x368919){_0x26f5d3['push'](_0x26f5d3['shift']());}};_0x4885cd(++_0x2fe393);}(_0x2fe3,0x107));const _0x4885=function(_0x26f5d3,_0x2fe393){_0x26f5d3=_0x26f5d3-0x0;let _0x4885cd=_0x2fe3[_0x26f5d3];return _0x4885cd;};import{Element as _0x257e7c}from'ckeditor5/src/engine';import{ObservableMixin as _0x284ad1,uid as _0x4ecbcc}from'ckeditor5/src/utils';import{cloneDeep as _0x53905a,isEqual as _0x74b05f,set as _0x1142c2,unset as _0x5580dd}from'lodash-es';export default class u extends _0x284ad1(){constructor(_0x43c8c2,_0x513ed7){super(),this[_0x4885('0xb')]=!0x1,this['id']=_0x513ed7['id'],this['type']=_0x513ed7[_0x4885('0x3')],this[_0x4885('0x13')]=_0x513ed7['subType']||null,this[_0x4885('0x29')]=_0x513ed7[_0x4885('0x29')],this['creator']=_0x513ed7[_0x4885('0x1c')]||_0x513ed7[_0x4885('0x29')],this[_0x4885('0x2b')]=Boolean(_0x513ed7[_0x4885('0x32')]&&_0x513ed7[_0x4885('0x32')][_0x4885('0x1e')]),this[_0x4885('0x39')]=null,this['_model']=_0x43c8c2,this[_0x4885('0x12')]=_0x513ed7['onAccept'],this['_onDiscard']=_0x513ed7[_0x4885('0x28')],this[_0x4885('0x10')]=_0x513ed7[_0x4885('0x2')],this[_0x4885('0x20')]=new Set(),this[_0x4885('0x3a')]=null,this[_0x4885('0x22')](_0x4885('0x35'),null),this[_0x4885('0x22')](_0x4885('0x32'),_0x513ed7['attributes']||{}),this[_0x4885('0x22')](_0x4885('0xc'),null),this[_0x4885('0x22')](_0x4885('0x11'),null),this[_0x4885('0x22')](_0x4885('0x2d'),null),this[_0x4885('0x22')](_0x4885('0x33'),!0x1),this[_0x4885('0x5')]('accept'),this[_0x4885('0x5')](_0x4885('0x18'));}get['head'](){let _0xdaeb14=this;for(;_0xdaeb14['previous'];)_0xdaeb14=_0xdaeb14[_0x4885('0xc')];return _0xdaeb14;}get[_0x4885('0x2a')](){return!!this[_0x4885('0x2d')]&&this[_0x4885('0x2d')][_0x4885('0x19')]>0x0;}get['isMultiRange'](){if(0x0==this[_0x4885('0x20')][_0x4885('0x17')])return!0x1;return 0x6==Array[_0x4885('0x4')](this[_0x4885('0x20')])[0x0]['split'](':')['length'];}get[_0x4885('0x16')](){return null!==this[_0x4885('0x27')]();}[_0x4885('0x2c')](_0x1bc994){this[_0x4885('0x20')][_0x4885('0xf')](_0x1bc994);}[_0x4885('0x36')](){return Array[_0x4885('0x4')](this[_0x4885('0x20')]);}[_0x4885('0x31')](){return this[_0x4885('0x36')]()[_0x4885('0x25')](_0x1ab597=>this[_0x4885('0x24')][_0x4885('0xd')][_0x4885('0x1f')](_0x1ab597))['filter'](_0xb33cc1=>_0xb33cc1);}['getFirstMarker'](){return this[_0x4885('0x31')]()[0x0]||null;}[_0x4885('0x14')](){this[_0x4885('0x24')][_0x4885('0x7')](_0x47e935=>{for(const _0x5bb3b9 of this[_0x4885('0x31')]())_0x47e935[_0x4885('0x9')](_0x5bb3b9);}),this[_0x4885('0x20')][_0x4885('0x3c')]();}[_0x4885('0x9')](_0x421a8a){this[_0x4885('0x24')][_0x4885('0x7')](_0x35d133=>{_0x35d133[_0x4885('0x9')](_0x421a8a);}),this[_0x4885('0x20')][_0x4885('0x37')](_0x421a8a);}[_0x4885('0x6')](_0x230ecb){const _0x19e827=_0x4885('0x30')+this[_0x4885('0x3')]+':'+this[_0x4885('0x13')]+':'+this['id']+':'+this[_0x4885('0x1c')]['id']+':'+u[_0x4885('0x1b')]();this[_0x4885('0x2c')](_0x19e827),this['_model']['change'](_0x3d6000=>{_0x3d6000['addMarker'](_0x19e827,{'range':_0x230ecb,'usingOperation':!0x0,'affectsData':!0x0});});}['isIntersectingWithRange'](_0x1a0ed0){for(const _0x797ee of this[_0x4885('0x8')]())if(_0x797ee[_0x4885('0x1a')](_0x1a0ed0))return!0x0;return!0x1;}[_0x4885('0x8')](){return this[_0x4885('0x31')]()[_0x4885('0x25')](_0x24803d=>_0x24803d[_0x4885('0x1')]());}[_0x4885('0x26')](){return this[_0x4885('0x8')]()[_0x4885('0xa')]((_0x1a9264,_0xb5b328)=>[..._0x1a9264,..._0xb5b328['getItems']()],[]);}[_0x4885('0x23')](){var _0x3582d1;return(null===(_0x3582d1=this['getFirstMarker']())||void 0x0===_0x3582d1?void 0x0:_0x3582d1[_0x4885('0x1')]())||null;}['getContainedElement'](){const _0x4992fb=this[_0x4885('0x8')]();if(0x1!=_0x4992fb['length'])return null;const _0x509631=_0x4992fb[0x0],_0x37faf4=_0x509631[_0x4885('0x34')]['nodeAfter'],_0x441b1b=_0x509631[_0x4885('0x2e')][_0x4885('0x15')];return _0x37faf4 instanceof _0x257e7c?_0x37faf4!=_0x441b1b?null:_0x37faf4:null;}[_0x4885('0x0')](){this[_0x4885('0x12')](this[_0x4885('0x8')](),this['data'],this[_0x4885('0x32')]),this[_0x4885('0x14')]();}[_0x4885('0x18')](){this[_0x4885('0x1d')](this['getRanges'](),this[_0x4885('0x39')],this[_0x4885('0x32')]),this['removeMarkers']();}['getAllAdjacentSuggestions'](){const _0x3fc832=[];let _0x16a4fb=this[_0x4885('0x3b')];for(;_0x16a4fb;)_0x3fc832['push'](_0x16a4fb),_0x16a4fb=_0x16a4fb['next'];return _0x3fc832;}[_0x4885('0xe')](_0x5e58a2,_0x122759){const _0x40a839=_0x53905a(this[_0x4885('0x32')]);_0x1142c2(_0x40a839,_0x5e58a2,_0x122759),_0x74b05f(_0x40a839,this[_0x4885('0x32')])||(this[_0x4885('0x32')]=_0x40a839,this[_0x4885('0x10')](_0x40a839));}[_0x4885('0x21')](_0x54dfbc){const _0xcd3631=_0x53905a(this[_0x4885('0x32')]);_0x5580dd(_0xcd3631,_0x54dfbc),_0x74b05f(_0xcd3631,this[_0x4885('0x32')])||(this['attributes']=_0xcd3631,this[_0x4885('0x10')](this[_0x4885('0x32')]));}[_0x4885('0x2f')](){return{'id':this['id'],'type':this[_0x4885('0x13')]?this[_0x4885('0x3')]+':'+this[_0x4885('0x13')]:this[_0x4885('0x3')],'authorId':this[_0x4885('0x1c')]['id'],'createdAt':this['createdAt'],'hasComments':this[_0x4885('0x2a')],'data':this['data'],'attributes':this[_0x4885('0x32')]};}static['getMultiRangeId'](){return _0x4ecbcc()[_0x4885('0x38')](0x1,0x5);}}