@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.
- package/build/track-changes.js +1 -1
- package/package.json +3 -3
- package/src/augmentation.d.ts +36 -36
- package/src/commands/acceptsuggestioncommand.d.ts +20 -20
- package/src/commands/acceptsuggestioncommand.js +1 -1
- package/src/commands/discardsuggestioncommand.d.ts +20 -20
- package/src/commands/discardsuggestioncommand.js +1 -1
- package/src/commands/executeonallsuggestionscommand.d.ts +20 -20
- package/src/commands/executeonallsuggestionscommand.js +1 -1
- package/src/commands/executeonselectedsuggestionscommand.d.ts +20 -20
- package/src/commands/executeonselectedsuggestionscommand.js +1 -1
- package/src/commands/trackchangescommand.d.ts +22 -22
- package/src/commands/trackchangescommand.js +1 -1
- package/src/index.d.ts +12 -12
- package/src/integrations/alignment.d.ts +13 -13
- package/src/integrations/alignment.js +1 -1
- package/src/integrations/basicstyles.d.ts +13 -13
- package/src/integrations/basicstyles.js +1 -1
- package/src/integrations/blockquote.d.ts +13 -13
- package/src/integrations/blockquote.js +1 -1
- package/src/integrations/ckbox.d.ts +13 -13
- package/src/integrations/ckbox.js +1 -1
- package/src/integrations/codeblock.d.ts +13 -13
- package/src/integrations/codeblock.js +1 -1
- package/src/integrations/comments.d.ts +10 -10
- package/src/integrations/comments.js +1 -1
- package/src/integrations/deletecommand.d.ts +13 -13
- package/src/integrations/deletecommand.js +1 -1
- package/src/integrations/documentlist.d.ts +13 -13
- package/src/integrations/documentlist.js +1 -1
- package/src/integrations/documentlistproperties.d.ts +25 -25
- package/src/integrations/documentlistproperties.js +1 -1
- package/src/integrations/entercommand.d.ts +12 -12
- package/src/integrations/entercommand.js +1 -1
- package/src/integrations/findandreplace.d.ts +17 -17
- package/src/integrations/findandreplace.js +1 -1
- package/src/integrations/font.d.ts +13 -13
- package/src/integrations/font.js +1 -1
- package/src/integrations/formatpainter.d.ts +13 -13
- package/src/integrations/formatpainter.js +1 -1
- package/src/integrations/heading.d.ts +13 -13
- package/src/integrations/heading.js +1 -1
- package/src/integrations/highlight.d.ts +13 -13
- package/src/integrations/highlight.js +1 -1
- package/src/integrations/horizontalline.d.ts +13 -13
- package/src/integrations/horizontalline.js +1 -1
- package/src/integrations/htmlembed.d.ts +13 -13
- package/src/integrations/htmlembed.js +1 -1
- package/src/integrations/image.d.ts +13 -13
- package/src/integrations/image.js +1 -1
- package/src/integrations/imagereplace.d.ts +19 -19
- package/src/integrations/imagereplace.js +1 -1
- package/src/integrations/importword.d.ts +14 -14
- package/src/integrations/importword.js +1 -1
- package/src/integrations/indent.d.ts +13 -13
- package/src/integrations/indent.js +1 -1
- package/src/integrations/inputcommand.d.ts +12 -12
- package/src/integrations/inputcommand.js +1 -1
- package/src/integrations/link.d.ts +13 -13
- package/src/integrations/link.js +1 -1
- package/src/integrations/list.d.ts +13 -13
- package/src/integrations/list.js +1 -1
- package/src/integrations/listproperties.d.ts +25 -25
- package/src/integrations/listproperties.js +1 -1
- package/src/integrations/mediaembed.d.ts +13 -13
- package/src/integrations/mediaembed.js +1 -1
- package/src/integrations/mention.d.ts +13 -13
- package/src/integrations/mention.js +1 -1
- package/src/integrations/pagebreak.d.ts +13 -13
- package/src/integrations/pagebreak.js +1 -1
- package/src/integrations/paragraph.d.ts +13 -13
- package/src/integrations/paragraph.js +1 -1
- package/src/integrations/removeformat.d.ts +13 -13
- package/src/integrations/removeformat.js +1 -1
- package/src/integrations/restrictededitingmode.d.ts +13 -13
- package/src/integrations/restrictededitingmode.js +1 -1
- package/src/integrations/shiftentercommand.d.ts +12 -12
- package/src/integrations/shiftentercommand.js +1 -1
- package/src/integrations/standardeditingmode.d.ts +13 -13
- package/src/integrations/standardeditingmode.js +1 -1
- package/src/integrations/style.d.ts +14 -14
- package/src/integrations/style.js +1 -1
- package/src/integrations/table.d.ts +38 -38
- package/src/integrations/table.js +1 -1
- package/src/integrations/tablecaption.d.ts +18 -18
- package/src/integrations/tablecaption.js +1 -1
- package/src/integrations/tableclipboard.d.ts +18 -18
- package/src/integrations/tableclipboard.js +1 -1
- package/src/integrations/tablecolumnresize.d.ts +22 -22
- package/src/integrations/tablecolumnresize.js +1 -1
- package/src/integrations/tableheadings.d.ts +18 -18
- package/src/integrations/tableheadings.js +1 -1
- package/src/integrations/tablemergesplit.d.ts +18 -18
- package/src/integrations/tablemergesplit.js +1 -1
- package/src/integrations/tableofcontents.d.ts +13 -13
- package/src/integrations/tableofcontents.js +1 -1
- package/src/integrations/tableproperties.d.ts +23 -23
- package/src/integrations/tableproperties.js +1 -1
- package/src/integrations/template.d.ts +13 -13
- package/src/integrations/template.js +1 -1
- package/src/integrations/title.d.ts +13 -13
- package/src/integrations/title.js +1 -1
- package/src/integrations/undo.d.ts +13 -13
- package/src/integrations/undo.js +1 -1
- package/src/integrations/utils.d.ts +17 -17
- package/src/integrations/utils.js +1 -1
- package/src/suggestion.d.ts +266 -266
- package/src/suggestion.js +1 -1
- package/src/suggestiondescriptionfactory.d.ts +151 -151
- package/src/suggestiondescriptionfactory.js +1 -1
- package/src/trackchanges.d.ts +240 -240
- package/src/trackchanges.js +1 -1
- package/src/trackchangesconfig.d.ts +71 -71
- package/src/trackchangesdata.d.ts +37 -37
- package/src/trackchangesdata.js +1 -1
- package/src/trackchangesediting.d.ts +435 -435
- package/src/trackchangesediting.js +1 -1
- package/src/trackchangesui.d.ts +34 -34
- package/src/trackchangesui.js +1 -1
- package/src/ui/suggestioncontroller.d.ts +36 -36
- package/src/ui/suggestioncontroller.js +1 -1
- package/src/ui/view/basesuggestionthreadview.d.ts +166 -166
- package/src/ui/view/basesuggestionthreadview.js +1 -1
- package/src/ui/view/suggestionthreadview.d.ts +182 -182
- package/src/ui/view/suggestionthreadview.js +1 -1
- package/src/utils/common-translations.d.ts +5 -5
- package/src/utils/common-translations.js +1 -1
- package/src/utils/utils.d.ts +26 -26
- package/src/utils/utils.js +1 -1
package/src/suggestion.d.ts
CHANGED
|
@@ -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
|
|
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);}}
|