@ckeditor/ckeditor5-track-changes 38.1.0 → 38.1.1

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 (129) hide show
  1. package/build/track-changes.js +1 -1
  2. package/package.json +3 -3
  3. package/src/augmentation.d.ts +36 -36
  4. package/src/commands/acceptsuggestioncommand.d.ts +20 -20
  5. package/src/commands/acceptsuggestioncommand.js +1 -1
  6. package/src/commands/discardsuggestioncommand.d.ts +20 -20
  7. package/src/commands/discardsuggestioncommand.js +1 -1
  8. package/src/commands/executeonallsuggestionscommand.d.ts +20 -20
  9. package/src/commands/executeonallsuggestionscommand.js +1 -1
  10. package/src/commands/executeonselectedsuggestionscommand.d.ts +20 -20
  11. package/src/commands/executeonselectedsuggestionscommand.js +1 -1
  12. package/src/commands/trackchangescommand.d.ts +22 -22
  13. package/src/commands/trackchangescommand.js +1 -1
  14. package/src/index.d.ts +12 -12
  15. package/src/integrations/alignment.d.ts +13 -13
  16. package/src/integrations/alignment.js +1 -1
  17. package/src/integrations/basicstyles.d.ts +13 -13
  18. package/src/integrations/basicstyles.js +1 -1
  19. package/src/integrations/blockquote.d.ts +13 -13
  20. package/src/integrations/blockquote.js +1 -1
  21. package/src/integrations/ckbox.d.ts +13 -13
  22. package/src/integrations/ckbox.js +1 -1
  23. package/src/integrations/codeblock.d.ts +13 -13
  24. package/src/integrations/codeblock.js +1 -1
  25. package/src/integrations/comments.d.ts +10 -10
  26. package/src/integrations/comments.js +1 -1
  27. package/src/integrations/deletecommand.d.ts +13 -13
  28. package/src/integrations/deletecommand.js +1 -1
  29. package/src/integrations/documentlist.d.ts +13 -13
  30. package/src/integrations/documentlist.js +1 -1
  31. package/src/integrations/documentlistproperties.d.ts +25 -25
  32. package/src/integrations/documentlistproperties.js +1 -1
  33. package/src/integrations/entercommand.d.ts +12 -12
  34. package/src/integrations/entercommand.js +1 -1
  35. package/src/integrations/findandreplace.d.ts +17 -17
  36. package/src/integrations/findandreplace.js +1 -1
  37. package/src/integrations/font.d.ts +13 -13
  38. package/src/integrations/font.js +1 -1
  39. package/src/integrations/formatpainter.d.ts +13 -13
  40. package/src/integrations/formatpainter.js +1 -1
  41. package/src/integrations/heading.d.ts +13 -13
  42. package/src/integrations/heading.js +1 -1
  43. package/src/integrations/highlight.d.ts +13 -13
  44. package/src/integrations/highlight.js +1 -1
  45. package/src/integrations/horizontalline.d.ts +13 -13
  46. package/src/integrations/horizontalline.js +1 -1
  47. package/src/integrations/htmlembed.d.ts +13 -13
  48. package/src/integrations/htmlembed.js +1 -1
  49. package/src/integrations/image.d.ts +13 -13
  50. package/src/integrations/image.js +1 -1
  51. package/src/integrations/imagereplace.d.ts +19 -19
  52. package/src/integrations/imagereplace.js +1 -1
  53. package/src/integrations/importword.d.ts +14 -14
  54. package/src/integrations/importword.js +1 -1
  55. package/src/integrations/indent.d.ts +13 -13
  56. package/src/integrations/indent.js +1 -1
  57. package/src/integrations/inputcommand.d.ts +12 -12
  58. package/src/integrations/inputcommand.js +1 -1
  59. package/src/integrations/link.d.ts +13 -13
  60. package/src/integrations/link.js +1 -1
  61. package/src/integrations/list.d.ts +13 -13
  62. package/src/integrations/list.js +1 -1
  63. package/src/integrations/listproperties.d.ts +25 -25
  64. package/src/integrations/listproperties.js +1 -1
  65. package/src/integrations/mediaembed.d.ts +13 -13
  66. package/src/integrations/mediaembed.js +1 -1
  67. package/src/integrations/mention.d.ts +13 -13
  68. package/src/integrations/mention.js +1 -1
  69. package/src/integrations/pagebreak.d.ts +13 -13
  70. package/src/integrations/pagebreak.js +1 -1
  71. package/src/integrations/paragraph.d.ts +13 -13
  72. package/src/integrations/paragraph.js +1 -1
  73. package/src/integrations/removeformat.d.ts +13 -13
  74. package/src/integrations/removeformat.js +1 -1
  75. package/src/integrations/restrictededitingmode.d.ts +13 -13
  76. package/src/integrations/restrictededitingmode.js +1 -1
  77. package/src/integrations/shiftentercommand.d.ts +12 -12
  78. package/src/integrations/shiftentercommand.js +1 -1
  79. package/src/integrations/standardeditingmode.d.ts +13 -13
  80. package/src/integrations/standardeditingmode.js +1 -1
  81. package/src/integrations/style.d.ts +14 -14
  82. package/src/integrations/style.js +1 -1
  83. package/src/integrations/table.d.ts +38 -38
  84. package/src/integrations/table.js +1 -1
  85. package/src/integrations/tablecaption.d.ts +18 -18
  86. package/src/integrations/tablecaption.js +1 -1
  87. package/src/integrations/tableclipboard.d.ts +18 -18
  88. package/src/integrations/tableclipboard.js +1 -1
  89. package/src/integrations/tablecolumnresize.d.ts +22 -22
  90. package/src/integrations/tablecolumnresize.js +1 -1
  91. package/src/integrations/tableheadings.d.ts +18 -18
  92. package/src/integrations/tableheadings.js +1 -1
  93. package/src/integrations/tablemergesplit.d.ts +18 -18
  94. package/src/integrations/tablemergesplit.js +1 -1
  95. package/src/integrations/tableofcontents.d.ts +13 -13
  96. package/src/integrations/tableofcontents.js +1 -1
  97. package/src/integrations/tableproperties.d.ts +23 -23
  98. package/src/integrations/tableproperties.js +1 -1
  99. package/src/integrations/template.d.ts +13 -13
  100. package/src/integrations/template.js +1 -1
  101. package/src/integrations/title.d.ts +13 -13
  102. package/src/integrations/title.js +1 -1
  103. package/src/integrations/undo.d.ts +13 -13
  104. package/src/integrations/undo.js +1 -1
  105. package/src/integrations/utils.d.ts +17 -17
  106. package/src/integrations/utils.js +1 -1
  107. package/src/suggestion.d.ts +266 -266
  108. package/src/suggestion.js +1 -1
  109. package/src/suggestiondescriptionfactory.d.ts +151 -151
  110. package/src/suggestiondescriptionfactory.js +1 -1
  111. package/src/trackchanges.d.ts +240 -240
  112. package/src/trackchanges.js +1 -1
  113. package/src/trackchangesconfig.d.ts +71 -71
  114. package/src/trackchangesdata.d.ts +37 -37
  115. package/src/trackchangesdata.js +1 -1
  116. package/src/trackchangesediting.d.ts +435 -435
  117. package/src/trackchangesediting.js +1 -1
  118. package/src/trackchangesui.d.ts +34 -34
  119. package/src/trackchangesui.js +1 -1
  120. package/src/ui/suggestioncontroller.d.ts +36 -36
  121. package/src/ui/suggestioncontroller.js +1 -1
  122. package/src/ui/view/basesuggestionthreadview.d.ts +166 -166
  123. package/src/ui/view/basesuggestionthreadview.js +1 -1
  124. package/src/ui/view/suggestionthreadview.d.ts +182 -182
  125. package/src/ui/view/suggestionthreadview.js +1 -1
  126. package/src/utils/common-translations.d.ts +5 -5
  127. package/src/utils/common-translations.js +1 -1
  128. package/src/utils/utils.d.ts +26 -26
  129. package/src/utils/utils.js +1 -1
@@ -1,266 +1,266 @@
1
- /**
2
- * @module track-changes/suggestion
3
- * @publicApi
4
- */
5
- import { Element, type Marker, type Model, type Range, type Item } from 'ckeditor5/src/engine';
6
- import type { User } from 'ckeditor5-collaboration/src/collaboration-core';
7
- import type { CommentThread } from '@ckeditor/ckeditor5-comments';
8
- import type { FormatData } from './trackchangesediting';
9
- declare const Suggestion_base: {
10
- new (): import("ckeditor5/src/utils").Observable;
11
- prototype: import("ckeditor5/src/utils").Observable;
12
- };
13
- /**
14
- * Represents a singular suggestion that is tracked by track changes plugin.
15
- *
16
- * `Suggestion` instances are created and handled by {@link module:track-changes/trackchanges~TrackChanges track changes plugin}.
17
- */
18
- export default class Suggestion extends Suggestion_base {
19
- /**
20
- * Suggestion ID.
21
- */
22
- readonly id: string;
23
- /**
24
- * Suggestion type.
25
- */
26
- type: SuggestionType;
27
- /**
28
- * Suggestion sub-type.
29
- *
30
- * This is an additional identifier for suggestions. Two suggestions of the same type may have different sub-types to differentiate
31
- * suggestions behavior and handle interactions between suggestions.
32
- *
33
- * Sub-type is used for:
34
- *
35
- * * suggestions joining (only suggestions with the same sub-type can be joined),
36
- * * suggestions custom callbacks (fired when adding, deleting and joining suggestions).
37
- */
38
- subType: string | null;
39
- /**
40
- * The author of the change marked by the suggestion.
41
- */
42
- author: User;
43
- /**
44
- * The user which saved the suggestion data in the database.
45
- *
46
- * Usually the same as author but may be different in some cases (e.g. when suggestion was added from an external source).
47
- */
48
- creator: User;
49
- /**
50
- * The flag indicating whether the suggestion comes from an external source.
51
- */
52
- isExternal: boolean;
53
- /**
54
- * Additional suggestion data.
55
- */
56
- data: FormatData | null;
57
- /**
58
- * Date when the suggestion was saved in the database.
59
- */
60
- createdAt: Date | null;
61
- /**
62
- * Date when the change marked by the suggestion was made.
63
- *
64
- * Usually the same as {@link #createdAt `createdAt`} but may be different in some cases
65
- * (e.g. when suggestion was added from an external source).
66
- *
67
- * @observable
68
- */
69
- authoredAt: Date | null;
70
- /**
71
- * Custom suggestion attributes. See also {@link #setAttribute} and {@link #removeAttribute}.
72
- *
73
- * @observable
74
- */
75
- attributes: {
76
- [k: string]: unknown;
77
- };
78
- /**
79
- * Previous suggestion in suggestions chain.
80
- *
81
- * Chained suggestions should be handled as one entity.
82
- *
83
- * @observable
84
- */
85
- previous: Suggestion | null;
86
- /**
87
- * Next suggestion in suggestions chain.
88
- *
89
- * Chained suggestions should be handled as one entity.
90
- *
91
- * @observable
92
- */
93
- next: Suggestion | null;
94
- /**
95
- * Comment thread model for comments added to this suggestion.
96
- *
97
- * @observable
98
- */
99
- commentThread: CommentThread | null;
100
- constructor(model: Model, options: SuggestionOptions);
101
- /**
102
- * The first (most-previous) suggestion in this suggestion chain.
103
- */
104
- get head(): Suggestion;
105
- /**
106
- * Informs whether suggestion has at least one comment.
107
- */
108
- get hasComments(): boolean;
109
- /**
110
- * Informs whether the suggestion is a multi-range suggestion or a single-range suggestion.
111
- *
112
- * This is evaluated basing on the marker name belonging to this suggestion.
113
- * Even if only one marker belongs to the suggestion at a given time it can still be a multi range suggestion.
114
- */
115
- get isMultiRange(): boolean;
116
- /**
117
- * Informs whether the suggestion is still in the editor content.
118
- *
119
- * Returns `true` if there is at least one marker suggestion in the editor content.
120
- */
121
- get isInContent(): boolean;
122
- /**
123
- * Binds given marker name to this suggestion.
124
- */
125
- addMarkerName(markerName: string): void;
126
- /**
127
- * Returns all names of markers belonging to this suggestion.
128
- */
129
- getMarkerNames(): Array<string>;
130
- /**
131
- * Returns all markers belonging to this suggestion.
132
- */
133
- getMarkers(): Array<Marker>;
134
- /**
135
- * Returns the first marker belonging to this suggestion, i.e the first marker that was added to this suggestion
136
- * and not removed yet.
137
- *
138
- * This method is useful if you know that the suggestion has only one marker and want to process it.
139
- */
140
- getFirstMarker(): Marker | null;
141
- /**
142
- * Removes all markers from the suggestion and the editor content.
143
- */
144
- removeMarkers(): void;
145
- /**
146
- * Removes marker with the given name from the suggestion and the editor content.
147
- */
148
- removeMarker(markerName: string): void;
149
- /**
150
- * Adds a new range to this suggestion. It is assumed that the suggestion is a multi-range suggestion.
151
- *
152
- * A marker name is generated from this suggestion's properties and a marker with that name is created and set to a given `range`.
153
- */
154
- addRange(range: Range): void;
155
- /**
156
- * Checks if given `range` is intersecting with any of the ranges of markers belonging to this suggestion.
157
- */
158
- isIntersectingWithRange(range: Range): boolean;
159
- /**
160
- * Returns all ranges of all markers belonging to this suggestion.
161
- */
162
- getRanges(): Array<Range>;
163
- /**
164
- * Returns all {@link module:engine/model/item~Item model items} that are in this suggestion.
165
- */
166
- getItems(): Array<Item>;
167
- /**
168
- * Returns the first range belonging to this suggestion, i.e. the range of the first marker that was added to
169
- * this suggestion and not removed yet.
170
- *
171
- * This method is useful if you know that the suggestion has only one marker and want to process its range.
172
- */
173
- getFirstRange(): Range | null;
174
- /**
175
- * Returns the model element contained in the suggestion.
176
- *
177
- * A {@link module:engine/model/element~Element model element} is considered as contained if there is exactly
178
- * one range in the suggestion, and that range contains exactly one element.
179
- *
180
- * Returns `null` if there is no contained element.
181
- */
182
- getContainedElement(): Element | null;
183
- /**
184
- * Accepts the suggestion.
185
- */
186
- accept(): void;
187
- /**
188
- * Discards the suggestion.
189
- */
190
- discard(): void;
191
- /**
192
- * Returns all suggestions that are in this suggestion chain.
193
- */
194
- getAllAdjacentSuggestions(): Array<Suggestion>;
195
- /**
196
- * Adds suggestion attribute.
197
- *
198
- * Suggestion attributes are custom data that can be set and used by features
199
- * built around suggestions. Use it to store your feature data with other suggestion data.
200
- *
201
- * ```ts
202
- * suggestion.setAttribute( 'isImportant', true );
203
- * ```
204
- *
205
- * You can group multiple values in an object, using dot notation:
206
- *
207
- * ```ts
208
- * suggestion.setAttribute( 'customData.type', 'image' );
209
- * suggestion.setAttribute( 'customData.src', 'foo.jpg' );
210
- * ```
211
- *
212
- * Attributes set on the suggestion can be accessed through `attribute` property:
213
- *
214
- * ```ts
215
- * const isImportant = suggestion.attributes.isImportant;
216
- * const type = suggestion.attributes.customData.type;
217
- * ```
218
- *
219
- * You can also observe `attributes` property or bind other properties to it:
220
- *
221
- * ```ts
222
- * myObj.bind( 'customData' ).to( suggestion, 'attributes', attributes => attributes.customData );
223
- * ```
224
- *
225
- * Whenever `setAttribute()` or `removeAttribute()` is called, `attributes` property
226
- * is re-set and observables are refreshed.
227
- */
228
- setAttribute(name: string, value: unknown): void;
229
- /**
230
- * Removes suggestion attribute.
231
- *
232
- * See also {@link #setAttribute}
233
- */
234
- removeAttribute(name: string): void;
235
- toJSON(): SuggestionJSON;
236
- /**
237
- * Returns a random string that can be used as additional identifier for the marker name for suggestions that are multi range.
238
- */
239
- static getMultiRangeId(): string;
240
- }
241
- export interface SuggestionOptions {
242
- id: string;
243
- type: SuggestionType;
244
- subType: string | null;
245
- attributes: {
246
- [k: string]: unknown;
247
- };
248
- author: User;
249
- creator: User;
250
- onAccept: Function;
251
- onDiscard: Function;
252
- onAttributesChange: Function;
253
- }
254
- export interface SuggestionJSON {
255
- id: string;
256
- type: string;
257
- authorId: string;
258
- createdAt: Date | null;
259
- hasComments?: boolean;
260
- data?: FormatData | null;
261
- attributes: {
262
- [k: string]: unknown;
263
- };
264
- }
265
- export type SuggestionType = 'insertion' | 'deletion' | 'formatInline' | 'formatBlock';
266
- export {};
1
+ /**
2
+ * @module track-changes/suggestion
3
+ * @publicApi
4
+ */
5
+ import { Element, type Marker, type Model, type Range, type Item } from 'ckeditor5/src/engine';
6
+ import type { User } from 'ckeditor5-collaboration/src/collaboration-core';
7
+ import type { CommentThread } from '@ckeditor/ckeditor5-comments';
8
+ import type { FormatData } from './trackchangesediting';
9
+ declare const Suggestion_base: {
10
+ new (): import("ckeditor5/src/utils").Observable;
11
+ prototype: import("ckeditor5/src/utils").Observable;
12
+ };
13
+ /**
14
+ * Represents a singular suggestion that is tracked by track changes plugin.
15
+ *
16
+ * `Suggestion` instances are created and handled by {@link module:track-changes/trackchanges~TrackChanges track changes plugin}.
17
+ */
18
+ export default class Suggestion extends Suggestion_base {
19
+ /**
20
+ * Suggestion ID.
21
+ */
22
+ readonly id: string;
23
+ /**
24
+ * Suggestion type.
25
+ */
26
+ type: SuggestionType;
27
+ /**
28
+ * Suggestion sub-type.
29
+ *
30
+ * This is an additional identifier for suggestions. Two suggestions of the same type may have different sub-types to differentiate
31
+ * suggestions behavior and handle interactions between suggestions.
32
+ *
33
+ * Sub-type is used for:
34
+ *
35
+ * * suggestions joining (only suggestions with the same sub-type can be joined),
36
+ * * suggestions custom callbacks (fired when adding, deleting and joining suggestions).
37
+ */
38
+ subType: string | null;
39
+ /**
40
+ * The author of the change marked by the suggestion.
41
+ */
42
+ author: User;
43
+ /**
44
+ * The user which saved the suggestion data in the database.
45
+ *
46
+ * Usually the same as author but may be different in some cases (e.g. when suggestion was added from an external source).
47
+ */
48
+ creator: User;
49
+ /**
50
+ * The flag indicating whether the suggestion comes from an external source.
51
+ */
52
+ isExternal: boolean;
53
+ /**
54
+ * Additional suggestion data.
55
+ */
56
+ data: FormatData | null;
57
+ /**
58
+ * Date when the suggestion was saved in the database.
59
+ */
60
+ createdAt: Date | null;
61
+ /**
62
+ * Date when the change marked by the suggestion was made.
63
+ *
64
+ * Usually the same as {@link #createdAt `createdAt`} but may be different in some cases
65
+ * (e.g. when suggestion was added from an external source).
66
+ *
67
+ * @observable
68
+ */
69
+ authoredAt: Date | null;
70
+ /**
71
+ * Custom suggestion attributes. See also {@link #setAttribute} and {@link #removeAttribute}.
72
+ *
73
+ * @observable
74
+ */
75
+ attributes: {
76
+ [k: string]: unknown;
77
+ };
78
+ /**
79
+ * Previous suggestion in suggestions chain.
80
+ *
81
+ * Chained suggestions should be handled as one entity.
82
+ *
83
+ * @observable
84
+ */
85
+ previous: Suggestion | null;
86
+ /**
87
+ * Next suggestion in suggestions chain.
88
+ *
89
+ * Chained suggestions should be handled as one entity.
90
+ *
91
+ * @observable
92
+ */
93
+ next: Suggestion | null;
94
+ /**
95
+ * Comment thread model for comments added to this suggestion.
96
+ *
97
+ * @observable
98
+ */
99
+ commentThread: CommentThread | null;
100
+ constructor(model: Model, options: SuggestionOptions);
101
+ /**
102
+ * The first (most-previous) suggestion in this suggestion chain.
103
+ */
104
+ get head(): Suggestion;
105
+ /**
106
+ * Informs whether suggestion has at least one comment.
107
+ */
108
+ get hasComments(): boolean;
109
+ /**
110
+ * Informs whether the suggestion is a multi-range suggestion or a single-range suggestion.
111
+ *
112
+ * This is evaluated basing on the marker name belonging to this suggestion.
113
+ * Even if only one marker belongs to the suggestion at a given time it can still be a multi range suggestion.
114
+ */
115
+ get isMultiRange(): boolean;
116
+ /**
117
+ * Informs whether the suggestion is still in the editor content.
118
+ *
119
+ * Returns `true` if there is at least one marker suggestion in the editor content.
120
+ */
121
+ get isInContent(): boolean;
122
+ /**
123
+ * Binds given marker name to this suggestion.
124
+ */
125
+ addMarkerName(markerName: string): void;
126
+ /**
127
+ * Returns all names of markers belonging to this suggestion.
128
+ */
129
+ getMarkerNames(): Array<string>;
130
+ /**
131
+ * Returns all markers belonging to this suggestion.
132
+ */
133
+ getMarkers(): Array<Marker>;
134
+ /**
135
+ * Returns the first marker belonging to this suggestion, i.e the first marker that was added to this suggestion
136
+ * and not removed yet.
137
+ *
138
+ * This method is useful if you know that the suggestion has only one marker and want to process it.
139
+ */
140
+ getFirstMarker(): Marker | null;
141
+ /**
142
+ * Removes all markers from the suggestion and the editor content.
143
+ */
144
+ removeMarkers(): void;
145
+ /**
146
+ * Removes marker with the given name from the suggestion and the editor content.
147
+ */
148
+ removeMarker(markerName: string): void;
149
+ /**
150
+ * Adds a new range to this suggestion. It is assumed that the suggestion is a multi-range suggestion.
151
+ *
152
+ * A marker name is generated from this suggestion's properties and a marker with that name is created and set to a given `range`.
153
+ */
154
+ addRange(range: Range): void;
155
+ /**
156
+ * Checks if given `range` is intersecting with any of the ranges of markers belonging to this suggestion.
157
+ */
158
+ isIntersectingWithRange(range: Range): boolean;
159
+ /**
160
+ * Returns all ranges of all markers belonging to this suggestion.
161
+ */
162
+ getRanges(): Array<Range>;
163
+ /**
164
+ * Returns all {@link module:engine/model/item~Item model items} that are in this suggestion.
165
+ */
166
+ getItems(): Array<Item>;
167
+ /**
168
+ * Returns the first range belonging to this suggestion, i.e. the range of the first marker that was added to
169
+ * this suggestion and not removed yet.
170
+ *
171
+ * This method is useful if you know that the suggestion has only one marker and want to process its range.
172
+ */
173
+ getFirstRange(): Range | null;
174
+ /**
175
+ * Returns the model element contained in the suggestion.
176
+ *
177
+ * A {@link module:engine/model/element~Element model element} is considered as contained if there is exactly
178
+ * one range in the suggestion, and that range contains exactly one element.
179
+ *
180
+ * Returns `null` if there is no contained element.
181
+ */
182
+ getContainedElement(): Element | null;
183
+ /**
184
+ * Accepts the suggestion.
185
+ */
186
+ accept(): void;
187
+ /**
188
+ * Discards the suggestion.
189
+ */
190
+ discard(): void;
191
+ /**
192
+ * Returns all suggestions that are in this suggestion chain.
193
+ */
194
+ getAllAdjacentSuggestions(): Array<Suggestion>;
195
+ /**
196
+ * Adds suggestion attribute.
197
+ *
198
+ * Suggestion attributes are custom data that can be set and used by features
199
+ * built around suggestions. Use it to store your feature data with other suggestion data.
200
+ *
201
+ * ```ts
202
+ * suggestion.setAttribute( 'isImportant', true );
203
+ * ```
204
+ *
205
+ * You can group multiple values in an object, using dot notation:
206
+ *
207
+ * ```ts
208
+ * suggestion.setAttribute( 'customData.type', 'image' );
209
+ * suggestion.setAttribute( 'customData.src', 'foo.jpg' );
210
+ * ```
211
+ *
212
+ * Attributes set on the suggestion can be accessed through `attribute` property:
213
+ *
214
+ * ```ts
215
+ * const isImportant = suggestion.attributes.isImportant;
216
+ * const type = suggestion.attributes.customData.type;
217
+ * ```
218
+ *
219
+ * You can also observe `attributes` property or bind other properties to it:
220
+ *
221
+ * ```ts
222
+ * myObj.bind( 'customData' ).to( suggestion, 'attributes', attributes => attributes.customData );
223
+ * ```
224
+ *
225
+ * Whenever `setAttribute()` or `removeAttribute()` is called, `attributes` property
226
+ * is re-set and observables are refreshed.
227
+ */
228
+ setAttribute(name: string, value: unknown): void;
229
+ /**
230
+ * Removes suggestion attribute.
231
+ *
232
+ * See also {@link #setAttribute}
233
+ */
234
+ removeAttribute(name: string): void;
235
+ toJSON(): SuggestionJSON;
236
+ /**
237
+ * Returns a random string that can be used as additional identifier for the marker name for suggestions that are multi range.
238
+ */
239
+ static getMultiRangeId(): string;
240
+ }
241
+ export interface SuggestionOptions {
242
+ id: string;
243
+ type: SuggestionType;
244
+ subType: string | null;
245
+ attributes: {
246
+ [k: string]: unknown;
247
+ };
248
+ author: User;
249
+ creator: User;
250
+ onAccept: Function;
251
+ onDiscard: Function;
252
+ onAttributesChange: Function;
253
+ }
254
+ export interface SuggestionJSON {
255
+ id: string;
256
+ type: string;
257
+ authorId: string;
258
+ createdAt: Date | null;
259
+ hasComments?: boolean;
260
+ data?: FormatData | null;
261
+ attributes: {
262
+ [k: string]: unknown;
263
+ };
264
+ }
265
+ export type SuggestionType = 'insertion' | 'deletion' | 'formatInline' | 'formatBlock';
266
+ export {};
package/src/suggestion.js CHANGED
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x44e7=['size','creator','_onAccept','addRange','onDiscard','from','addMarkerName','length','suggestion:','data','_onDiscard','_model','_saved','add','_onAttributesChange','createdAt','onAttributesChange','set','end','change','isExternal','next','commentThread','getMarkerNames','toJSON','getRanges','getMarkers','type','attributes','previous','setAttribute','removeMarker','author','@external','onAccept','nodeAfter','push','removeMarkers','delete','isIntersectingWithRange','discard','_markerNames','authoredAt','decorate','hasComments','addMarker','getFirstMarker','clear','head','getFirstRange','getItems','isMultiRange','markers','start','nodeBefore','accept','subType'];(function(_0x2e5f57,_0x44e714){const _0x55835f=function(_0x5041ea){while(--_0x5041ea){_0x2e5f57['push'](_0x2e5f57['shift']());}};_0x55835f(++_0x44e714);}(_0x44e7,0x126));const _0x5583=function(_0x2e5f57,_0x44e714){_0x2e5f57=_0x2e5f57-0x0;let _0x55835f=_0x44e7[_0x2e5f57];return _0x55835f;};import{Element as _0x283f50}from'ckeditor5/src/engine';import{ObservableMixin as _0x632a53,uid as _0x4c9e6c}from'ckeditor5/src/utils';import{cloneDeep as _0x2848d0,isEqual as _0xcdb95c,set as _0x28f941,unset as _0x28c836}from'lodash-es';export default class u extends _0x632a53(){constructor(_0x3dbf24,_0xe28de6){super(),this['id']=_0xe28de6['id'],this['type']=_0xe28de6[_0x5583('0x12')],this[_0x5583('0x2f')]=_0xe28de6[_0x5583('0x2f')]||null,this[_0x5583('0x17')]=_0xe28de6[_0x5583('0x17')],this['creator']=_0xe28de6['creator']||_0xe28de6['author'],this[_0x5583('0xb')]=Boolean(_0xe28de6['attributes']&&_0xe28de6[_0x5583('0x13')][_0x5583('0x18')]),this[_0x5583('0x0')]=null,this[_0x5583('0x2')]=_0x3dbf24,this[_0x5583('0x32')]=_0xe28de6[_0x5583('0x19')],this[_0x5583('0x1')]=_0xe28de6[_0x5583('0x34')],this['_onAttributesChange']=_0xe28de6[_0x5583('0x7')],this[_0x5583('0x20')]=new Set(),this[_0x5583('0x6')]=null,this[_0x5583('0x8')](_0x5583('0x21'),null),this[_0x5583('0x8')](_0x5583('0x13'),_0xe28de6[_0x5583('0x13')]||{}),this[_0x5583('0x8')]('previous',null),this[_0x5583('0x8')](_0x5583('0xc'),null),this['set'](_0x5583('0xd'),null),this[_0x5583('0x8')](_0x5583('0x3'),!0x1),this[_0x5583('0x22')]('accept'),this[_0x5583('0x22')](_0x5583('0x1f'));}get['head'](){let _0x31f022=this;for(;_0x31f022[_0x5583('0x14')];)_0x31f022=_0x31f022[_0x5583('0x14')];return _0x31f022;}get[_0x5583('0x23')](){return!!this[_0x5583('0xd')]&&this[_0x5583('0xd')]['length']>0x0;}get[_0x5583('0x2a')](){if(0x0==this[_0x5583('0x20')][_0x5583('0x30')])return!0x1;return 0x6==Array[_0x5583('0x35')](this[_0x5583('0x20')])[0x0]['split'](':')[_0x5583('0x37')];}get['isInContent'](){return null!==this[_0x5583('0x25')]();}[_0x5583('0x36')](_0x493c32){this[_0x5583('0x20')][_0x5583('0x4')](_0x493c32);}['getMarkerNames'](){return Array[_0x5583('0x35')](this[_0x5583('0x20')]);}[_0x5583('0x11')](){return this[_0x5583('0xe')]()['map'](_0x45386f=>this['_model'][_0x5583('0x2b')]['get'](_0x45386f))['filter'](_0x4c5b22=>_0x4c5b22);}['getFirstMarker'](){return this[_0x5583('0x11')]()[0x0]||null;}[_0x5583('0x1c')](){this[_0x5583('0x2')][_0x5583('0xa')](_0x438e57=>{for(const _0x18548e of this['getMarkers']())_0x438e57[_0x5583('0x16')](_0x18548e);}),this[_0x5583('0x20')][_0x5583('0x26')]();}[_0x5583('0x16')](_0x116e44){this[_0x5583('0x2')][_0x5583('0xa')](_0x898457=>{_0x898457[_0x5583('0x16')](_0x116e44);}),this[_0x5583('0x20')][_0x5583('0x1d')](_0x116e44);}[_0x5583('0x33')](_0x5d7228){const _0x387679=_0x5583('0x38')+this[_0x5583('0x12')]+':'+this[_0x5583('0x2f')]+':'+this['id']+':'+this[_0x5583('0x31')]['id']+':'+u['getMultiRangeId']();this[_0x5583('0x36')](_0x387679),this['_model'][_0x5583('0xa')](_0x5c3739=>{_0x5c3739[_0x5583('0x24')](_0x387679,{'range':_0x5d7228,'usingOperation':!0x0,'affectsData':!0x0});});}[_0x5583('0x1e')](_0x3d7ef6){for(const _0x13e15f of this[_0x5583('0x10')]())if(_0x13e15f['isIntersecting'](_0x3d7ef6))return!0x0;return!0x1;}[_0x5583('0x10')](){return this[_0x5583('0x11')]()['map'](_0x353570=>_0x353570['getRange']());}[_0x5583('0x29')](){return this[_0x5583('0x10')]()['reduce']((_0x41b8db,_0x501348)=>[..._0x41b8db,..._0x501348[_0x5583('0x29')]()],[]);}[_0x5583('0x28')](){var _0x21bf72;return(null===(_0x21bf72=this['getFirstMarker']())||void 0x0===_0x21bf72?void 0x0:_0x21bf72['getRange']())||null;}['getContainedElement'](){const _0x3ba31c=this[_0x5583('0x10')]();if(0x1!=_0x3ba31c[_0x5583('0x37')])return null;const _0x524602=_0x3ba31c[0x0],_0x1df34e=_0x524602[_0x5583('0x2c')][_0x5583('0x1a')],_0x2d0b1a=_0x524602[_0x5583('0x9')][_0x5583('0x2d')];return _0x1df34e instanceof _0x283f50?_0x1df34e!=_0x2d0b1a?null:_0x1df34e:null;}[_0x5583('0x2e')](){this['_onAccept'](this[_0x5583('0x10')](),this[_0x5583('0x0')],this['attributes']),this[_0x5583('0x1c')]();}[_0x5583('0x1f')](){this[_0x5583('0x1')](this[_0x5583('0x10')](),this[_0x5583('0x0')],this[_0x5583('0x13')]),this[_0x5583('0x1c')]();}['getAllAdjacentSuggestions'](){const _0x24229a=[];let _0xe3335e=this[_0x5583('0x27')];for(;_0xe3335e;)_0x24229a[_0x5583('0x1b')](_0xe3335e),_0xe3335e=_0xe3335e[_0x5583('0xc')];return _0x24229a;}[_0x5583('0x15')](_0x4e8ce3,_0x423e19){const _0x22a2f5=_0x2848d0(this['attributes']);_0x28f941(_0x22a2f5,_0x4e8ce3,_0x423e19),_0xcdb95c(_0x22a2f5,this['attributes'])||(this[_0x5583('0x13')]=_0x22a2f5,this['_onAttributesChange'](_0x22a2f5));}['removeAttribute'](_0x5683ff){const _0x16365d=_0x2848d0(this[_0x5583('0x13')]);_0x28c836(_0x16365d,_0x5683ff),_0xcdb95c(_0x16365d,this[_0x5583('0x13')])||(this['attributes']=_0x16365d,this[_0x5583('0x5')](this[_0x5583('0x13')]));}[_0x5583('0xf')](){return{'id':this['id'],'type':this[_0x5583('0x2f')]?this[_0x5583('0x12')]+':'+this['subType']:this['type'],'authorId':this[_0x5583('0x31')]['id'],'createdAt':this[_0x5583('0x6')],'hasComments':this['hasComments'],'data':this[_0x5583('0x0')],'attributes':this[_0x5583('0x13')]};}static['getMultiRangeId'](){return _0x4c9e6c()['substr'](0x1,0x5);}}
23
+ const _0x1d5a=['toJSON','_onDiscard','length','addRange','getMarkerNames','end','reduce','addMarkerName','isInContent','set','isIntersectingWithRange','substr','previous','attributes','removeMarker','decorate','clear','hasComments','createdAt','suggestion:','split','removeMarkers','commentThread','from','getAllAdjacentSuggestions','map','getRanges','push','subType','_saved','getMarkers','getMultiRangeId','data','@external','discard','delete','accept','author','nodeBefore','getRange','head','type','getContainedElement','get','_onAttributesChange','change','isMultiRange','markers','_model','creator','_onAccept','size','getFirstMarker','onAttributesChange','onDiscard','filter','next','start','isIntersecting','getItems','isExternal','nodeAfter','_markerNames','setAttribute','getFirstRange','authoredAt'];(function(_0x417cfd,_0x1d5a6f){const _0x1ee642=function(_0x603ca1){while(--_0x603ca1){_0x417cfd['push'](_0x417cfd['shift']());}};_0x1ee642(++_0x1d5a6f);}(_0x1d5a,0x177));const _0x1ee6=function(_0x417cfd,_0x1d5a6f){_0x417cfd=_0x417cfd-0x0;let _0x1ee642=_0x1d5a[_0x417cfd];return _0x1ee642;};import{Element as _0x2485d7}from'ckeditor5/src/engine';import{ObservableMixin as _0x587f77,uid as _0x271f8f}from'ckeditor5/src/utils';import{cloneDeep as _0xc786c5,isEqual as _0x121b90,set as _0x1af7e7,unset as _0x9b74f7}from'lodash-es';export default class u extends _0x587f77(){constructor(_0x5188d0,_0x5c8c48){super(),this['id']=_0x5c8c48['id'],this['type']=_0x5c8c48[_0x1ee6('0x3e')],this[_0x1ee6('0x31')]=_0x5c8c48[_0x1ee6('0x31')]||null,this[_0x1ee6('0x3a')]=_0x5c8c48['author'],this[_0x1ee6('0x4')]=_0x5c8c48['creator']||_0x5c8c48[_0x1ee6('0x3a')],this[_0x1ee6('0xf')]=Boolean(_0x5c8c48[_0x1ee6('0x22')]&&_0x5c8c48['attributes'][_0x1ee6('0x36')]),this[_0x1ee6('0x35')]=null,this[_0x1ee6('0x3')]=_0x5188d0,this['_onAccept']=_0x5c8c48['onAccept'],this[_0x1ee6('0x16')]=_0x5c8c48[_0x1ee6('0x9')],this['_onAttributesChange']=_0x5c8c48[_0x1ee6('0x8')],this[_0x1ee6('0x11')]=new Set(),this[_0x1ee6('0x27')]=null,this[_0x1ee6('0x1e')](_0x1ee6('0x14'),null),this[_0x1ee6('0x1e')]('attributes',_0x5c8c48['attributes']||{}),this[_0x1ee6('0x1e')]('previous',null),this[_0x1ee6('0x1e')]('next',null),this[_0x1ee6('0x1e')]('commentThread',null),this[_0x1ee6('0x1e')](_0x1ee6('0x32'),!0x1),this[_0x1ee6('0x24')](_0x1ee6('0x39')),this[_0x1ee6('0x24')](_0x1ee6('0x37'));}get['head'](){let _0x531572=this;for(;_0x531572[_0x1ee6('0x21')];)_0x531572=_0x531572[_0x1ee6('0x21')];return _0x531572;}get[_0x1ee6('0x26')](){return!!this[_0x1ee6('0x2b')]&&this[_0x1ee6('0x2b')][_0x1ee6('0x17')]>0x0;}get[_0x1ee6('0x1')](){if(0x0==this[_0x1ee6('0x11')][_0x1ee6('0x6')])return!0x1;return 0x6==Array[_0x1ee6('0x2c')](this[_0x1ee6('0x11')])[0x0][_0x1ee6('0x29')](':')[_0x1ee6('0x17')];}get[_0x1ee6('0x1d')](){return null!==this['getFirstMarker']();}[_0x1ee6('0x1c')](_0x169a20){this[_0x1ee6('0x11')]['add'](_0x169a20);}[_0x1ee6('0x19')](){return Array[_0x1ee6('0x2c')](this[_0x1ee6('0x11')]);}[_0x1ee6('0x33')](){return this[_0x1ee6('0x19')]()[_0x1ee6('0x2e')](_0x78af3e=>this['_model'][_0x1ee6('0x2')][_0x1ee6('0x40')](_0x78af3e))[_0x1ee6('0xa')](_0xf3e43d=>_0xf3e43d);}[_0x1ee6('0x7')](){return this[_0x1ee6('0x33')]()[0x0]||null;}[_0x1ee6('0x2a')](){this['_model'][_0x1ee6('0x0')](_0xfa2c4=>{for(const _0xcd8111 of this[_0x1ee6('0x33')]())_0xfa2c4[_0x1ee6('0x23')](_0xcd8111);}),this[_0x1ee6('0x11')][_0x1ee6('0x25')]();}['removeMarker'](_0x24a79d){this[_0x1ee6('0x3')][_0x1ee6('0x0')](_0x5384aa=>{_0x5384aa[_0x1ee6('0x23')](_0x24a79d);}),this[_0x1ee6('0x11')][_0x1ee6('0x38')](_0x24a79d);}[_0x1ee6('0x18')](_0x540fcc){const _0xd428ce=_0x1ee6('0x28')+this['type']+':'+this[_0x1ee6('0x31')]+':'+this['id']+':'+this[_0x1ee6('0x4')]['id']+':'+u[_0x1ee6('0x34')]();this[_0x1ee6('0x1c')](_0xd428ce),this[_0x1ee6('0x3')][_0x1ee6('0x0')](_0x39c070=>{_0x39c070['addMarker'](_0xd428ce,{'range':_0x540fcc,'usingOperation':!0x0,'affectsData':!0x0});});}[_0x1ee6('0x1f')](_0x460492){for(const _0x52f9c9 of this[_0x1ee6('0x2f')]())if(_0x52f9c9[_0x1ee6('0xd')](_0x460492))return!0x0;return!0x1;}[_0x1ee6('0x2f')](){return this[_0x1ee6('0x33')]()[_0x1ee6('0x2e')](_0x4fbddc=>_0x4fbddc['getRange']());}[_0x1ee6('0xe')](){return this['getRanges']()[_0x1ee6('0x1b')]((_0x112896,_0x1ffa53)=>[..._0x112896,..._0x1ffa53[_0x1ee6('0xe')]()],[]);}[_0x1ee6('0x13')](){var _0x17b8f9;return(null===(_0x17b8f9=this[_0x1ee6('0x7')]())||void 0x0===_0x17b8f9?void 0x0:_0x17b8f9[_0x1ee6('0x3c')]())||null;}[_0x1ee6('0x3f')](){const _0x30a47f=this[_0x1ee6('0x2f')]();if(0x1!=_0x30a47f[_0x1ee6('0x17')])return null;const _0x3955f9=_0x30a47f[0x0],_0x567040=_0x3955f9[_0x1ee6('0xc')][_0x1ee6('0x10')],_0x327d07=_0x3955f9[_0x1ee6('0x1a')][_0x1ee6('0x3b')];return _0x567040 instanceof _0x2485d7?_0x567040!=_0x327d07?null:_0x567040:null;}['accept'](){this[_0x1ee6('0x5')](this[_0x1ee6('0x2f')](),this['data'],this[_0x1ee6('0x22')]),this[_0x1ee6('0x2a')]();}[_0x1ee6('0x37')](){this[_0x1ee6('0x16')](this['getRanges'](),this[_0x1ee6('0x35')],this['attributes']),this[_0x1ee6('0x2a')]();}[_0x1ee6('0x2d')](){const _0x5a751e=[];let _0x505b53=this[_0x1ee6('0x3d')];for(;_0x505b53;)_0x5a751e[_0x1ee6('0x30')](_0x505b53),_0x505b53=_0x505b53[_0x1ee6('0xb')];return _0x5a751e;}[_0x1ee6('0x12')](_0x23e997,_0x509b45){const _0x1ae9d1=_0xc786c5(this['attributes']);_0x1af7e7(_0x1ae9d1,_0x23e997,_0x509b45),_0x121b90(_0x1ae9d1,this['attributes'])||(this[_0x1ee6('0x22')]=_0x1ae9d1,this[_0x1ee6('0x41')](_0x1ae9d1));}['removeAttribute'](_0x1d1a31){const _0x5a5f5c=_0xc786c5(this[_0x1ee6('0x22')]);_0x9b74f7(_0x5a5f5c,_0x1d1a31),_0x121b90(_0x5a5f5c,this[_0x1ee6('0x22')])||(this[_0x1ee6('0x22')]=_0x5a5f5c,this[_0x1ee6('0x41')](this[_0x1ee6('0x22')]));}[_0x1ee6('0x15')](){return{'id':this['id'],'type':this[_0x1ee6('0x31')]?this[_0x1ee6('0x3e')]+':'+this[_0x1ee6('0x31')]:this[_0x1ee6('0x3e')],'authorId':this['creator']['id'],'createdAt':this[_0x1ee6('0x27')],'hasComments':this[_0x1ee6('0x26')],'data':this[_0x1ee6('0x35')],'attributes':this[_0x1ee6('0x22')]};}static[_0x1ee6('0x34')](){return _0x271f8f()[_0x1ee6('0x20')](0x1,0x5);}}