@ckeditor/ckeditor5-track-changes 38.0.1 → 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 +10 -8
  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 -12
  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 -11
  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 -11
  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 -11
  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 -17
  86. package/src/integrations/tablecaption.js +1 -1
  87. package/src/integrations/tableclipboard.d.ts +18 -17
  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 -17
  92. package/src/integrations/tableheadings.js +1 -1
  93. package/src/integrations/tablemergesplit.d.ts +18 -17
  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 -38
  115. package/src/trackchangesdata.js +1 -1
  116. package/src/trackchangesediting.d.ts +435 -391
  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 -184
  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/src/comments/commentsrepository';
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 _0x30e1=['creator','authoredAt','getItems','end','head','next','_onAccept','getMarkers','_onAttributesChange','decorate','size','from','commentThread','_model','getRanges','removeMarkers','nodeAfter','addRange','start','addMarkerName','set','reduce','isIntersecting','subType','markers','length','hasComments','removeMarker','@external','onAccept','getMultiRangeId','onDiscard','isExternal','change','createdAt','attributes','setAttribute','getMarkerNames','map','getRange','getAllAdjacentSuggestions','add','type','isMultiRange','author','_saved','previous','addMarker','delete','getFirstMarker','nodeBefore','suggestion:','clear','push','onAttributesChange','_markerNames','data'];(function(_0xc39538,_0x30e17c){const _0x17c2b9=function(_0x549572){while(--_0x549572){_0xc39538['push'](_0xc39538['shift']());}};_0x17c2b9(++_0x30e17c);}(_0x30e1,0x97));const _0x17c2=function(_0xc39538,_0x30e17c){_0xc39538=_0xc39538-0x0;let _0x17c2b9=_0x30e1[_0xc39538];return _0x17c2b9;};import{Element as _0x42a367}from'ckeditor5/src/engine';import{ObservableMixin as _0x347148,uid as _0x2893c9}from'ckeditor5/src/utils';import{cloneDeep as _0x106ab5,isEqual as _0x17301a,set as _0x2f7bab,unset as _0xc294ef}from'lodash-es';export default class u extends _0x347148(){constructor(_0x5073e4,_0x575566){super(),this['id']=_0x575566['id'],this[_0x17c2('0x5')]=_0x575566[_0x17c2('0x5')],this[_0x17c2('0x2b')]=_0x575566[_0x17c2('0x2b')]||null,this[_0x17c2('0x7')]=_0x575566[_0x17c2('0x7')],this[_0x17c2('0x14')]=_0x575566[_0x17c2('0x14')]||_0x575566[_0x17c2('0x7')],this[_0x17c2('0x34')]=Boolean(_0x575566[_0x17c2('0x37')]&&_0x575566[_0x17c2('0x37')][_0x17c2('0x30')]),this['data']=null,this[_0x17c2('0x21')]=_0x5073e4,this[_0x17c2('0x1a')]=_0x575566[_0x17c2('0x31')],this['_onDiscard']=_0x575566[_0x17c2('0x33')],this[_0x17c2('0x1c')]=_0x575566[_0x17c2('0x11')],this['_markerNames']=new Set(),this[_0x17c2('0x36')]=null,this['set'](_0x17c2('0x15'),null),this[_0x17c2('0x28')](_0x17c2('0x37'),_0x575566[_0x17c2('0x37')]||{}),this['set']('previous',null),this[_0x17c2('0x28')](_0x17c2('0x19'),null),this['set'](_0x17c2('0x20'),null),this[_0x17c2('0x28')](_0x17c2('0x8'),!0x1),this[_0x17c2('0x1d')]('accept'),this[_0x17c2('0x1d')]('discard');}get[_0x17c2('0x18')](){let _0x1c173d=this;for(;_0x1c173d[_0x17c2('0x9')];)_0x1c173d=_0x1c173d[_0x17c2('0x9')];return _0x1c173d;}get[_0x17c2('0x2e')](){return!!this['commentThread']&&this[_0x17c2('0x20')][_0x17c2('0x2d')]>0x0;}get[_0x17c2('0x6')](){if(0x0==this['_markerNames'][_0x17c2('0x1e')])return!0x1;return 0x6==Array[_0x17c2('0x1f')](this[_0x17c2('0x12')])[0x0]['split'](':')['length'];}get['isInContent'](){return null!==this[_0x17c2('0xc')]();}[_0x17c2('0x27')](_0x14e5f6){this[_0x17c2('0x12')][_0x17c2('0x4')](_0x14e5f6);}[_0x17c2('0x0')](){return Array[_0x17c2('0x1f')](this[_0x17c2('0x12')]);}[_0x17c2('0x1b')](){return this['getMarkerNames']()[_0x17c2('0x1')](_0x43ce92=>this[_0x17c2('0x21')][_0x17c2('0x2c')]['get'](_0x43ce92))['filter'](_0x46b602=>_0x46b602);}[_0x17c2('0xc')](){return this[_0x17c2('0x1b')]()[0x0]||null;}['removeMarkers'](){this[_0x17c2('0x21')][_0x17c2('0x35')](_0x452b1b=>{for(const _0x4b0798 of this[_0x17c2('0x1b')]())_0x452b1b[_0x17c2('0x2f')](_0x4b0798);}),this[_0x17c2('0x12')][_0x17c2('0xf')]();}[_0x17c2('0x2f')](_0x3f12c2){this[_0x17c2('0x21')]['change'](_0x4c9c68=>{_0x4c9c68[_0x17c2('0x2f')](_0x3f12c2);}),this['_markerNames'][_0x17c2('0xb')](_0x3f12c2);}[_0x17c2('0x25')](_0x61e9b1){const _0x5a9294=_0x17c2('0xe')+this['type']+':'+this[_0x17c2('0x2b')]+':'+this['id']+':'+this[_0x17c2('0x14')]['id']+':'+u[_0x17c2('0x32')]();this[_0x17c2('0x27')](_0x5a9294),this[_0x17c2('0x21')][_0x17c2('0x35')](_0x47d7da=>{_0x47d7da[_0x17c2('0xa')](_0x5a9294,{'range':_0x61e9b1,'usingOperation':!0x0,'affectsData':!0x0});});}['isIntersectingWithRange'](_0x3b84d1){for(const _0x5263ff of this[_0x17c2('0x22')]())if(_0x5263ff[_0x17c2('0x2a')](_0x3b84d1))return!0x0;return!0x1;}['getRanges'](){return this[_0x17c2('0x1b')]()[_0x17c2('0x1')](_0x5ede71=>_0x5ede71[_0x17c2('0x2')]());}[_0x17c2('0x16')](){return this[_0x17c2('0x22')]()[_0x17c2('0x29')]((_0x2480d5,_0x50fe35)=>[..._0x2480d5,..._0x50fe35[_0x17c2('0x16')]()],[]);}['getFirstRange'](){var _0x95875;return(null===(_0x95875=this[_0x17c2('0xc')]())||void 0x0===_0x95875?void 0x0:_0x95875[_0x17c2('0x2')]())||null;}['getContainedElement'](){const _0x52b9d0=this['getRanges']();if(0x1!=_0x52b9d0[_0x17c2('0x2d')])return null;const _0x59d542=_0x52b9d0[0x0],_0x17dc64=_0x59d542[_0x17c2('0x26')][_0x17c2('0x24')],_0x215df7=_0x59d542[_0x17c2('0x17')][_0x17c2('0xd')];return _0x17dc64 instanceof _0x42a367?_0x17dc64!=_0x215df7?null:_0x17dc64:null;}['accept'](){this[_0x17c2('0x1a')](this[_0x17c2('0x22')](),this[_0x17c2('0x13')],this[_0x17c2('0x37')]),this[_0x17c2('0x23')]();}['discard'](){this['_onDiscard'](this[_0x17c2('0x22')](),this[_0x17c2('0x13')],this[_0x17c2('0x37')]),this[_0x17c2('0x23')]();}[_0x17c2('0x3')](){const _0x260bf1=[];let _0x183bbd=this[_0x17c2('0x18')];for(;_0x183bbd;)_0x260bf1[_0x17c2('0x10')](_0x183bbd),_0x183bbd=_0x183bbd[_0x17c2('0x19')];return _0x260bf1;}[_0x17c2('0x38')](_0x2ee361,_0x47c6f4){const _0x216dde=_0x106ab5(this[_0x17c2('0x37')]);_0x2f7bab(_0x216dde,_0x2ee361,_0x47c6f4),_0x17301a(_0x216dde,this[_0x17c2('0x37')])||(this[_0x17c2('0x37')]=_0x216dde,this[_0x17c2('0x1c')](_0x216dde));}['removeAttribute'](_0x49a975){const _0xa74115=_0x106ab5(this[_0x17c2('0x37')]);_0xc294ef(_0xa74115,_0x49a975),_0x17301a(_0xa74115,this[_0x17c2('0x37')])||(this[_0x17c2('0x37')]=_0xa74115,this[_0x17c2('0x1c')](this[_0x17c2('0x37')]));}['toJSON'](){return{'id':this['id'],'type':this[_0x17c2('0x2b')]?this[_0x17c2('0x5')]+':'+this['subType']:this[_0x17c2('0x5')],'authorId':this[_0x17c2('0x14')]['id'],'createdAt':this['createdAt'],'hasComments':this[_0x17c2('0x2e')],'data':this[_0x17c2('0x13')],'attributes':this[_0x17c2('0x37')]};}static[_0x17c2('0x32')](){return _0x2893c9()['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);}}