@ckeditor/ckeditor5-track-changes 40.0.0 → 40.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -15
- package/LICENSE.md +3 -3
- package/README.md +1 -1
- package/build/track-changes.js +2 -2
- package/build/translations/ar.js +1 -1
- package/build/translations/az.js +1 -1
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/pl.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/ro.js +1 -1
- package/build/translations/ru.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sq.js +1 -1
- package/build/translations/sr-latn.js +1 -1
- package/build/translations/sr.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/tk.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/tt.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/ur.js +1 -1
- package/build/translations/vi.js +1 -1
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/lang/contexts.json +20 -1
- package/lang/translations/ar.po +78 -2
- package/lang/translations/az.po +77 -1
- package/lang/translations/bg.po +78 -2
- package/lang/translations/bn.po +78 -2
- package/lang/translations/ca.po +78 -2
- package/lang/translations/cs.po +78 -2
- package/lang/translations/da.po +78 -2
- package/lang/translations/de.po +78 -2
- package/lang/translations/el.po +78 -2
- package/lang/translations/en-au.po +78 -2
- package/lang/translations/en.po +78 -2
- package/lang/translations/es.po +78 -2
- package/lang/translations/et.po +78 -2
- package/lang/translations/fi.po +78 -2
- package/lang/translations/fr.po +78 -2
- package/lang/translations/gl.po +90 -14
- package/lang/translations/he.po +78 -2
- package/lang/translations/hi.po +78 -2
- package/lang/translations/hr.po +78 -2
- package/lang/translations/hu.po +78 -2
- package/lang/translations/id.po +78 -2
- package/lang/translations/it.po +78 -2
- package/lang/translations/ja.po +78 -2
- package/lang/translations/ko.po +78 -2
- package/lang/translations/lt.po +78 -2
- package/lang/translations/lv.po +78 -2
- package/lang/translations/ms.po +78 -2
- package/lang/translations/nl.po +78 -2
- package/lang/translations/no.po +78 -2
- package/lang/translations/pl.po +78 -2
- package/lang/translations/pt-br.po +96 -20
- package/lang/translations/pt.po +78 -2
- package/lang/translations/ro.po +78 -2
- package/lang/translations/ru.po +78 -2
- package/lang/translations/sk.po +78 -2
- package/lang/translations/sq.po +77 -1
- package/lang/translations/sr-latn.po +78 -2
- package/lang/translations/sr.po +78 -2
- package/lang/translations/sv.po +78 -2
- package/lang/translations/th.po +78 -2
- package/lang/translations/tk.po +77 -1
- package/lang/translations/tr.po +78 -2
- package/lang/translations/tt.po +77 -1
- package/lang/translations/uk.po +78 -2
- package/lang/translations/ur.po +77 -1
- package/lang/translations/vi.po +78 -2
- package/lang/translations/zh-cn.po +78 -2
- package/lang/translations/zh.po +78 -2
- package/package.json +3 -3
- package/src/augmentation.d.ts +40 -40
- package/src/commands/acceptsuggestioncommand.d.ts +24 -24
- package/src/commands/acceptsuggestioncommand.js +1 -1
- package/src/commands/discardsuggestioncommand.d.ts +24 -24
- package/src/commands/discardsuggestioncommand.js +1 -1
- package/src/commands/executeonallsuggestionscommand.d.ts +24 -24
- package/src/commands/executeonallsuggestionscommand.js +1 -1
- package/src/commands/executeonselectedsuggestionscommand.d.ts +24 -24
- package/src/commands/executeonselectedsuggestionscommand.js +1 -1
- package/src/commands/trackchangescommand.d.ts +26 -26
- package/src/commands/trackchangescommand.js +1 -1
- package/src/index.d.ts +16 -16
- package/src/integrations/aiassistant.d.ts +17 -17
- package/src/integrations/aiassistant.js +1 -1
- package/src/integrations/alignment.d.ts +17 -17
- package/src/integrations/alignment.js +1 -1
- package/src/integrations/basicstyles.d.ts +17 -17
- package/src/integrations/basicstyles.js +1 -1
- package/src/integrations/blockquote.d.ts +17 -17
- package/src/integrations/blockquote.js +1 -1
- package/src/integrations/ckbox.d.ts +17 -17
- package/src/integrations/ckbox.js +1 -1
- package/src/integrations/codeblock.d.ts +17 -17
- package/src/integrations/codeblock.js +1 -1
- package/src/integrations/comments.d.ts +14 -14
- package/src/integrations/comments.js +1 -1
- package/src/integrations/deletecommand.d.ts +17 -17
- package/src/integrations/deletecommand.js +1 -1
- package/src/integrations/documentlist.d.ts +17 -17
- package/src/integrations/documentlist.js +1 -1
- package/src/integrations/documentlistproperties.d.ts +29 -29
- package/src/integrations/documentlistproperties.js +1 -1
- package/src/integrations/entercommand.d.ts +16 -16
- package/src/integrations/entercommand.js +1 -1
- package/src/integrations/findandreplace.d.ts +21 -21
- package/src/integrations/findandreplace.js +1 -1
- package/src/integrations/font.d.ts +17 -17
- package/src/integrations/font.js +1 -1
- package/src/integrations/formatpainter.d.ts +17 -17
- package/src/integrations/formatpainter.js +1 -1
- package/src/integrations/heading.d.ts +17 -17
- package/src/integrations/heading.js +1 -1
- package/src/integrations/highlight.d.ts +17 -17
- package/src/integrations/highlight.js +1 -1
- package/src/integrations/horizontalline.d.ts +17 -17
- package/src/integrations/horizontalline.js +1 -1
- package/src/integrations/htmlembed.d.ts +17 -17
- package/src/integrations/htmlembed.js +1 -1
- package/src/integrations/image.d.ts +17 -17
- package/src/integrations/image.js +1 -1
- package/src/integrations/imagereplace.d.ts +17 -23
- package/src/integrations/imagereplace.js +1 -1
- package/src/integrations/imagestyle.d.ts +17 -0
- package/src/integrations/imagestyle.js +23 -0
- package/src/integrations/importword.d.ts +18 -18
- package/src/integrations/importword.js +1 -1
- package/src/integrations/indent.d.ts +17 -17
- package/src/integrations/indent.js +1 -1
- package/src/integrations/inputcommand.d.ts +16 -16
- package/src/integrations/inputcommand.js +1 -1
- package/src/integrations/link.d.ts +17 -17
- package/src/integrations/link.js +1 -1
- package/src/integrations/list.d.ts +17 -17
- package/src/integrations/list.js +1 -1
- package/src/integrations/listproperties.d.ts +29 -29
- package/src/integrations/listproperties.js +1 -1
- package/src/integrations/mediaembed.d.ts +17 -17
- package/src/integrations/mediaembed.js +1 -1
- package/src/integrations/mention.d.ts +17 -17
- package/src/integrations/mention.js +1 -1
- package/src/integrations/pagebreak.d.ts +17 -17
- package/src/integrations/pagebreak.js +1 -1
- package/src/integrations/paragraph.d.ts +17 -17
- package/src/integrations/paragraph.js +1 -1
- package/src/integrations/removeformat.d.ts +17 -17
- package/src/integrations/removeformat.js +1 -1
- package/src/integrations/restrictededitingmode.d.ts +17 -17
- package/src/integrations/restrictededitingmode.js +1 -1
- package/src/integrations/shiftentercommand.d.ts +16 -16
- package/src/integrations/shiftentercommand.js +1 -1
- package/src/integrations/standardeditingmode.d.ts +17 -17
- package/src/integrations/standardeditingmode.js +1 -1
- package/src/integrations/style.d.ts +17 -18
- package/src/integrations/style.js +1 -1
- package/src/integrations/table.d.ts +42 -42
- package/src/integrations/table.js +1 -1
- package/src/integrations/tablecaption.d.ts +22 -22
- package/src/integrations/tablecaption.js +1 -1
- package/src/integrations/tableclipboard.d.ts +19 -19
- package/src/integrations/tableclipboard.js +1 -1
- package/src/integrations/tablecolumnresize.d.ts +26 -26
- package/src/integrations/tablecolumnresize.js +1 -1
- package/src/integrations/tableheadings.d.ts +22 -22
- package/src/integrations/tableheadings.js +1 -1
- package/src/integrations/tablemergesplit.d.ts +22 -22
- package/src/integrations/tablemergesplit.js +1 -1
- package/src/integrations/tableofcontents.d.ts +17 -17
- package/src/integrations/tableofcontents.js +1 -1
- package/src/integrations/tableproperties.d.ts +27 -27
- package/src/integrations/tableproperties.js +1 -1
- package/src/integrations/template.d.ts +17 -17
- package/src/integrations/template.js +1 -1
- package/src/integrations/title.d.ts +17 -17
- package/src/integrations/title.js +1 -1
- package/src/integrations/undo.d.ts +17 -17
- package/src/integrations/undo.js +1 -1
- package/src/integrations/utils.d.ts +21 -21
- package/src/integrations/utils.js +1 -1
- package/src/suggestion.d.ts +291 -276
- package/src/suggestion.js +1 -1
- package/src/suggestiondescriptionfactory.d.ts +183 -163
- package/src/suggestiondescriptionfactory.js +1 -1
- package/src/trackchanges.d.ts +180 -244
- package/src/trackchanges.js +1 -1
- package/src/trackchangesconfig.d.ts +78 -75
- package/src/trackchangesdata.d.ts +41 -41
- package/src/trackchangesdata.js +1 -1
- package/src/trackchangesediting.d.ts +524 -468
- package/src/trackchangesediting.js +1 -1
- package/src/trackchangesui.d.ts +38 -38
- package/src/trackchangesui.js +1 -1
- package/src/ui/suggestioncontroller.d.ts +37 -37
- package/src/ui/suggestioncontroller.js +1 -1
- package/src/ui/view/basesuggestionthreadview.d.ts +170 -170
- 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 +9 -9
- package/src/utils/common-translations.js +1 -1
- package/src/utils/utils.d.ts +30 -30
- package/src/utils/utils.js +1 -1
package/src/trackchanges.d.ts
CHANGED
|
@@ -1,244 +1,180 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module track-changes/trackchanges
|
|
7
|
-
* @publicApi
|
|
8
|
-
*/
|
|
9
|
-
import { Plugin } from 'ckeditor5/src/core';
|
|
10
|
-
import TrackChangesUI from './trackchangesui';
|
|
11
|
-
import TrackChangesEditing from './trackchangesediting';
|
|
12
|
-
import 'ckeditor5-collaboration/src/collaboration-core';
|
|
13
|
-
import type { default as Suggestion, SuggestionJSON } from './suggestion';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* * `
|
|
43
|
-
* * `
|
|
44
|
-
* * `
|
|
45
|
-
* * `
|
|
46
|
-
* * `
|
|
47
|
-
* * `
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* editor.execute( '
|
|
54
|
-
* editor.execute( '
|
|
55
|
-
* editor.execute( '
|
|
56
|
-
* editor.execute( '
|
|
57
|
-
* editor.execute( '
|
|
58
|
-
* editor.execute( '
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
static get
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
*
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
*
|
|
182
|
-
* To set the adapter, overwrite {@link module:track-changes/trackchanges~TrackChanges#adapter the `TrackChanges#adapter` property}.
|
|
183
|
-
*/
|
|
184
|
-
export interface TrackChangesAdapter {
|
|
185
|
-
/**
|
|
186
|
-
* Called each time the suggestion data is needed.
|
|
187
|
-
*
|
|
188
|
-
* The method should return a promise that resolves with the suggestion data object.
|
|
189
|
-
*
|
|
190
|
-
* @param id The ID of the suggestion to get.
|
|
191
|
-
*/
|
|
192
|
-
getSuggestion(id: string): Promise<SuggestionData>;
|
|
193
|
-
/**
|
|
194
|
-
* Called each time a new suggestion is created.
|
|
195
|
-
*
|
|
196
|
-
* The method should save the suggestion data in the database
|
|
197
|
-
* and return a promise that should be resolved when the save is
|
|
198
|
-
* completed.
|
|
199
|
-
*
|
|
200
|
-
* If the promise resolves with an object with the `createdAt` property,
|
|
201
|
-
* this suggestion property will be updated in the suggestion in the editor.
|
|
202
|
-
* This lets you update the suggestion data with server-side information.
|
|
203
|
-
*
|
|
204
|
-
* The `suggestionData` object does not expect the `authorId` property.
|
|
205
|
-
* For security reasons, the author of the suggestion should be set
|
|
206
|
-
* on the server side.
|
|
207
|
-
*
|
|
208
|
-
* If `suggestionData.originalSuggestionId` is set, the new suggestion should
|
|
209
|
-
* have the `authorId` property set to the same as the suggestion with
|
|
210
|
-
* `originalSuggestionId`. This happens when one user splits
|
|
211
|
-
* another user's suggestion, creating a new suggestion as a result. See
|
|
212
|
-
* {@glink features/collaboration/track-changes/track-changes-integration#implementation Track changes integration} guide.
|
|
213
|
-
*
|
|
214
|
-
* **Note:** Failure to properly handle this property will result in editor crash in some scenarios.
|
|
215
|
-
*
|
|
216
|
-
* In any other case, use the current (local) user to set `authorId`.
|
|
217
|
-
*
|
|
218
|
-
* The `suggestionData` object does not expect the `createdAt` property either.
|
|
219
|
-
* You should use the server-side time generator to ensure that all users
|
|
220
|
-
* see the same date.
|
|
221
|
-
*
|
|
222
|
-
* It is recommended to stringify `suggestionData.attributes` value to JSON and save it as a string in your database,
|
|
223
|
-
* and then to parse the strings when loading suggestions.
|
|
224
|
-
*/
|
|
225
|
-
addSuggestion(suggestionData: AddSuggestionInput): Promise<SuggestionData>;
|
|
226
|
-
/**
|
|
227
|
-
* Called each time the suggestion properties change.
|
|
228
|
-
*
|
|
229
|
-
* The method should update the suggestion properties in the database
|
|
230
|
-
* and return a promise that should be resolved when the save is
|
|
231
|
-
* completed.
|
|
232
|
-
*
|
|
233
|
-
* Keep in mind that the `data` parameter only contains those
|
|
234
|
-
* properties of a suggestion which changed.
|
|
235
|
-
*/
|
|
236
|
-
updateSuggestion(id: string, suggestionData: UpdateSuggestionInput): Promise<void>;
|
|
237
|
-
}
|
|
238
|
-
export type SuggestionData = SuggestionJSON & {
|
|
239
|
-
originalSuggestionId?: string | null;
|
|
240
|
-
};
|
|
241
|
-
export type AddSuggestionInput = Omit<SuggestionData, 'authorId' | 'createdAt'>;
|
|
242
|
-
export type UpdateSuggestionInput = Partial<Pick<SuggestionJSON, 'hasComments' | 'attributes'>> & {
|
|
243
|
-
state?: 'open' | 'accepted' | 'rejected';
|
|
244
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module track-changes/trackchanges
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
10
|
+
import TrackChangesUI from './trackchangesui';
|
|
11
|
+
import TrackChangesEditing from './trackchangesediting';
|
|
12
|
+
import 'ckeditor5-collaboration/src/collaboration-core';
|
|
13
|
+
import type { default as Suggestion, SuggestionJSON } from './suggestion';
|
|
14
|
+
/**
|
|
15
|
+
* A plugin that provides track changes mode for the editor. In track changes mode, all insertions are visually marked and all deletions
|
|
16
|
+
* are not deleted but also visually marked. Unsupported commands are disabled when the editor is in the track changes mode.
|
|
17
|
+
*
|
|
18
|
+
* To learn how to integrate the track changes feature with your editor, refer to the
|
|
19
|
+
* {@glink features/collaboration/track-changes/track-changes-integration Track changes integration} guide.
|
|
20
|
+
*
|
|
21
|
+
* Basic API:
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* // Get the track changes plugin:
|
|
25
|
+
* const trackChangesPlugin = editor.plugins.get( 'TrackChanges' );
|
|
26
|
+
*
|
|
27
|
+
* // Add a suggestion:
|
|
28
|
+
* trackChangesPlugin.addSuggestion( suggestionData );
|
|
29
|
+
*
|
|
30
|
+
* // Get all suggestions:
|
|
31
|
+
* trackChangesPlugin.getSuggestions();
|
|
32
|
+
*
|
|
33
|
+
* // Set the adapter:
|
|
34
|
+
* trackChangesPlugin.adapter = {
|
|
35
|
+
* // ...
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* The plugin registers several commands:
|
|
40
|
+
*
|
|
41
|
+
* * `trackChanges` – Toggles the track changes mode in the editor.
|
|
42
|
+
* * `acceptSuggestion` – Accepts a suggestion with the specified ID.
|
|
43
|
+
* * `discardSuggestion` – Discards a suggestion with the specified ID.
|
|
44
|
+
* * `acceptAllSuggestions` – Accepts all suggestions.
|
|
45
|
+
* * `discardAllSuggestions` – Discards all suggestions.
|
|
46
|
+
* * `acceptSelectedSuggestions` – Accepts all suggestions in the current selection.
|
|
47
|
+
* * `discardSelectedSuggestions` – Discards all suggestions in the current selection.
|
|
48
|
+
*
|
|
49
|
+
* Examples:
|
|
50
|
+
*
|
|
51
|
+
* ```ts
|
|
52
|
+
* editor.execute( 'trackChanges' );
|
|
53
|
+
* editor.execute( 'acceptSuggestion', 'suggestion-1' );
|
|
54
|
+
* editor.execute( 'discardSuggestion', 'suggestion-1' );
|
|
55
|
+
* editor.execute( 'acceptAllSuggestions' );
|
|
56
|
+
* editor.execute( 'discardAllSuggestions' );
|
|
57
|
+
* editor.execute( 'acceptSelectedSuggestions' );
|
|
58
|
+
* editor.execute( 'discardSelectedSuggestions' )
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* Note that there is no command to add a suggestion. This is because suggestions
|
|
62
|
+
* are added automatically when editing commands are executed while the editor is in track
|
|
63
|
+
* changes mode. For instance:
|
|
64
|
+
*
|
|
65
|
+
* ```ts
|
|
66
|
+
* // Turn on the track changes mode:
|
|
67
|
+
* editor.execute( 'trackChanges' );
|
|
68
|
+
*
|
|
69
|
+
* // Insert some text. It will be automatically inserted as a suggestion:
|
|
70
|
+
* editor.execute( 'input', { text: 'foo' } );
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export default class TrackChanges extends Plugin {
|
|
74
|
+
static get requires(): readonly [typeof TrackChangesEditing, typeof TrackChangesUI, "Comments"];
|
|
75
|
+
static get pluginName(): "TrackChanges";
|
|
76
|
+
/**
|
|
77
|
+
* An adapter object that should communicate with the data source to fetch or save the suggestion data.
|
|
78
|
+
*
|
|
79
|
+
* This is a shorthand to {@link module:track-changes/trackchangesediting~TrackChangesEditing#adapter `TrackChangesEditing#adapter`}.
|
|
80
|
+
*/
|
|
81
|
+
set adapter(adapter: TrackChangesAdapter | null);
|
|
82
|
+
get adapter(): TrackChangesAdapter | null;
|
|
83
|
+
/**
|
|
84
|
+
* Adds suggestion data.
|
|
85
|
+
*
|
|
86
|
+
* Use this method to load the suggestion data during the editor initialization if you do not use the adapter integration.
|
|
87
|
+
*/
|
|
88
|
+
addSuggestion(suggestionData: SuggestionData): Suggestion;
|
|
89
|
+
getSuggestions(options: {
|
|
90
|
+
skipNotAttached?: boolean;
|
|
91
|
+
toJSON: true;
|
|
92
|
+
}): Array<SuggestionJSON>;
|
|
93
|
+
getSuggestions(options?: {
|
|
94
|
+
skipNotAttached?: boolean;
|
|
95
|
+
toJSON?: false;
|
|
96
|
+
}): Array<Suggestion>;
|
|
97
|
+
getSuggestions(options: {
|
|
98
|
+
skipNotAttached?: boolean;
|
|
99
|
+
toJSON: boolean;
|
|
100
|
+
}): Array<Suggestion> | Array<SuggestionJSON>;
|
|
101
|
+
/**
|
|
102
|
+
* Returns the suggestion instance for a given ID.
|
|
103
|
+
*/
|
|
104
|
+
getSuggestion(id: string): Suggestion;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Track changes adapter.
|
|
108
|
+
*
|
|
109
|
+
* The track changes adapter is an object that communicates asynchronously with the data source to fetch or save the suggestion data.
|
|
110
|
+
* It is used internally by the track changes feature whenever a suggestion is loaded, created or deleted.
|
|
111
|
+
*
|
|
112
|
+
* The adapter is optional. You might need to provide it if you are {@glink features/collaboration/track-changes/track-changes-integration}
|
|
113
|
+
* using the track changes feature without real-time collaboration.
|
|
114
|
+
*
|
|
115
|
+
* To set the adapter, overwrite {@link module:track-changes/trackchanges~TrackChanges#adapter the `TrackChanges#adapter` property}.
|
|
116
|
+
*/
|
|
117
|
+
export interface TrackChangesAdapter {
|
|
118
|
+
/**
|
|
119
|
+
* Called each time the suggestion data is needed.
|
|
120
|
+
*
|
|
121
|
+
* The method should return a promise that resolves with the suggestion data object.
|
|
122
|
+
*
|
|
123
|
+
* @param id The ID of the suggestion to get.
|
|
124
|
+
*/
|
|
125
|
+
getSuggestion(id: string): Promise<SuggestionData>;
|
|
126
|
+
/**
|
|
127
|
+
* Called each time a new suggestion is created.
|
|
128
|
+
*
|
|
129
|
+
* The method should save the suggestion data in the database
|
|
130
|
+
* and return a promise that should be resolved when the save is
|
|
131
|
+
* completed.
|
|
132
|
+
*
|
|
133
|
+
* If the promise resolves with an object with the `createdAt` property,
|
|
134
|
+
* this suggestion property will be updated in the suggestion in the editor.
|
|
135
|
+
* This lets you update the suggestion data with server-side information.
|
|
136
|
+
*
|
|
137
|
+
* The `suggestionData` object does not expect the `authorId` property.
|
|
138
|
+
* For security reasons, the author of the suggestion should be set
|
|
139
|
+
* on the server side.
|
|
140
|
+
*
|
|
141
|
+
* If `suggestionData.originalSuggestionId` is set, the new suggestion should
|
|
142
|
+
* have the `authorId` property set to the same as the suggestion with
|
|
143
|
+
* `originalSuggestionId`. This happens when one user splits
|
|
144
|
+
* another user's suggestion, creating a new suggestion as a result. See
|
|
145
|
+
* {@glink features/collaboration/track-changes/track-changes-integration#implementation Track changes integration} guide.
|
|
146
|
+
*
|
|
147
|
+
* **Note:** Failure to properly handle this property will result in editor crash in some scenarios.
|
|
148
|
+
*
|
|
149
|
+
* In any other case, use the current (local) user to set `authorId`.
|
|
150
|
+
*
|
|
151
|
+
* The `suggestionData` object does not expect the `createdAt` property either.
|
|
152
|
+
* You should use the server-side time generator to ensure that all users
|
|
153
|
+
* see the same date.
|
|
154
|
+
*
|
|
155
|
+
* It is recommended to stringify `suggestionData.attributes` value to JSON and save it as a string in your database,
|
|
156
|
+
* and then to parse the strings when loading suggestions.
|
|
157
|
+
*/
|
|
158
|
+
addSuggestion(suggestionData: AddSuggestionInput): Promise<SuggestionData>;
|
|
159
|
+
/**
|
|
160
|
+
* Called each time the suggestion properties change.
|
|
161
|
+
*
|
|
162
|
+
* The method should update the suggestion properties in the database
|
|
163
|
+
* and return a promise that should be resolved when the save is
|
|
164
|
+
* completed.
|
|
165
|
+
*
|
|
166
|
+
* Keep in mind that the `data` parameter only contains those
|
|
167
|
+
* properties of a suggestion which changed.
|
|
168
|
+
*/
|
|
169
|
+
updateSuggestion(id: string, suggestionData: UpdateSuggestionInput): Promise<void>;
|
|
170
|
+
}
|
|
171
|
+
export interface SuggestionData extends SuggestionJSON {
|
|
172
|
+
/**
|
|
173
|
+
* Original suggestion ID from which the current one was split.
|
|
174
|
+
*/
|
|
175
|
+
originalSuggestionId?: string | null;
|
|
176
|
+
}
|
|
177
|
+
export type AddSuggestionInput = Omit<SuggestionData, 'authorId' | 'createdAt'>;
|
|
178
|
+
export type UpdateSuggestionInput = Partial<Pick<SuggestionJSON, 'hasComments' | 'attributes'>> & {
|
|
179
|
+
state?: 'open' | 'accepted' | 'rejected';
|
|
180
|
+
};
|
package/src/trackchanges.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
var
|
|
23
|
+
var _0x5530=['getSuggestion','editor','addSuggestionData','getSuggestions','Comments','requires','get','plugins','adapter'];(function(_0x274512,_0x55305f){var _0x8d564f=function(_0xafaa3a){while(--_0xafaa3a){_0x274512['push'](_0x274512['shift']());}};_0x8d564f(++_0x55305f);}(_0x5530,0x109));var _0x8d56=function(_0x274512,_0x55305f){_0x274512=_0x274512-0x0;var _0x8d564f=_0x5530[_0x274512];return _0x8d564f;};import{Plugin as _0x22d739}from'ckeditor5/src/core';import _0x4b66e5 from'./trackchangesui';import _0x4398e5 from'./trackchangesediting';import'ckeditor5-collaboration/src/collaboration-core';export default class k extends _0x22d739{static get[_0x8d56('0x1')](){return[_0x4398e5,_0x4b66e5,_0x8d56('0x0')];}static get['pluginName'](){return'TrackChanges';}set[_0x8d56('0x4')](_0x1256f4){this[_0x8d56('0x6')][_0x8d56('0x3')][_0x8d56('0x2')](_0x4398e5)[_0x8d56('0x4')]=_0x1256f4;}get[_0x8d56('0x4')](){return this[_0x8d56('0x6')][_0x8d56('0x3')][_0x8d56('0x2')](_0x4398e5)[_0x8d56('0x4')];}['addSuggestion'](_0x567b97){return this[_0x8d56('0x6')][_0x8d56('0x3')][_0x8d56('0x2')](_0x4398e5)[_0x8d56('0x7')](_0x567b97);}[_0x8d56('0x8')]({skipNotAttached:_0x2ba71d=!0x1,toJSON:_0x44b5c3=!0x1}={}){return this[_0x8d56('0x6')][_0x8d56('0x3')][_0x8d56('0x2')](_0x4398e5)['getSuggestions']({'skipNotAttached':_0x2ba71d,'toJSON':_0x44b5c3});}['getSuggestion'](_0x1ee43b){return this[_0x8d56('0x6')][_0x8d56('0x3')]['get'](_0x4398e5)[_0x8d56('0x5')](_0x1ee43b);}}
|
|
@@ -1,75 +1,78 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module track-changes/trackchangesconfig
|
|
7
|
-
* @publicApi
|
|
8
|
-
*/
|
|
9
|
-
import type SuggestionThreadView from './ui/view/suggestionthreadview';
|
|
10
|
-
/**
|
|
11
|
-
* The configuration of the track changes feature.
|
|
12
|
-
*
|
|
13
|
-
* Example:
|
|
14
|
-
*
|
|
15
|
-
* ```ts
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
33
|
-
*/
|
|
34
|
-
export interface TrackChangesConfig {
|
|
35
|
-
/**
|
|
36
|
-
* A property that specifies if the comments for suggestions are enabled or disabled.
|
|
37
|
-
* When the option is set to `true`, the comment thread UI for suggestions will be hidden
|
|
38
|
-
* and commenting suggestions will be disabled.
|
|
39
|
-
*
|
|
40
|
-
* Suggestion thread views will be marked with the additional `ck-suggestion--disabled-comments` class when the suggestion comments
|
|
41
|
-
* are disabled.
|
|
42
|
-
*/
|
|
43
|
-
disableComments: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* A property that specifies whether
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
*
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module track-changes/trackchangesconfig
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import type SuggestionThreadView from './ui/view/suggestionthreadview';
|
|
10
|
+
/**
|
|
11
|
+
* The configuration of the track changes feature.
|
|
12
|
+
*
|
|
13
|
+
* Example:
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* ClassicEditor
|
|
17
|
+
* .create( {
|
|
18
|
+
* // Track changes feature configuration.
|
|
19
|
+
* trackChanges: {
|
|
20
|
+
* // Do not allow users to comment suggestions (default is `false`).
|
|
21
|
+
* disableComments: true,
|
|
22
|
+
* // Do not track styling and formatting changes (default is `default`).
|
|
23
|
+
* trackFormatChanges: 'never',
|
|
24
|
+
* // Merges suggestion changes inside a block. (default is `true`).
|
|
25
|
+
* mergeNestedSuggestions: true
|
|
26
|
+
* }
|
|
27
|
+
* } )
|
|
28
|
+
* .then( ... )
|
|
29
|
+
* .catch( ... );
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
33
|
+
*/
|
|
34
|
+
export interface TrackChangesConfig {
|
|
35
|
+
/**
|
|
36
|
+
* A property that specifies if the comments for suggestions are enabled or disabled.
|
|
37
|
+
* When the option is set to `true`, the comment thread UI for suggestions will be hidden
|
|
38
|
+
* and commenting suggestions will be disabled.
|
|
39
|
+
*
|
|
40
|
+
* Suggestion thread views will be marked with the additional `ck-suggestion--disabled-comments` class when the suggestion comments
|
|
41
|
+
* are disabled.
|
|
42
|
+
*/
|
|
43
|
+
disableComments: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* A property that specifies whether formatting changes should be tracked.
|
|
46
|
+
*
|
|
47
|
+
* Formatting changes are all changes other than insertions and deletions, including: styling, structure, widgets properties, etc.
|
|
48
|
+
*
|
|
49
|
+
* By default, formatting changes are tracked. However, if you make a formatting change inside your own insertion suggestion, it
|
|
50
|
+
* is immediately applied, without creating a suggestion.
|
|
51
|
+
*
|
|
52
|
+
* Possible values are:
|
|
53
|
+
*
|
|
54
|
+
* * `'default'` - format changes are tracked, but when made inside your own insertion suggestion, they will be immediately applied.
|
|
55
|
+
* * `'always'` - format changes will always be tracked, even inside your own insertion suggestion.
|
|
56
|
+
* * `'never'` - format changes will never be tracked (suggestions for such changes will not be created).
|
|
57
|
+
*
|
|
58
|
+
* Defaults to `'default'`.
|
|
59
|
+
*/
|
|
60
|
+
trackFormatChanges: 'never' | 'default' | 'always';
|
|
61
|
+
/**
|
|
62
|
+
* Specifies whether suggestions on an object (e.g. image, table) should be automatically merged
|
|
63
|
+
* with suggestions inside the object (e.g. image caption, table cell).
|
|
64
|
+
*
|
|
65
|
+
* For example, when set to `true`, creating a table and writing some text inside the table will result in one suggestion.
|
|
66
|
+
* When set to `false`, it will be two separate suggestions, one for the inserted table and one for the inserted text.
|
|
67
|
+
*
|
|
68
|
+
* Keep in mind that only suggestions from the same author and of the same type are merged this way.
|
|
69
|
+
*/
|
|
70
|
+
mergeNestedSuggestions: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* A view class to be used to create suggestion thread views.
|
|
73
|
+
*
|
|
74
|
+
* {@link module:track-changes/ui/view/suggestionthreadview~SuggestionThreadView} is used by default
|
|
75
|
+
* when this property is not set.
|
|
76
|
+
*/
|
|
77
|
+
SuggestionThreadView?: typeof SuggestionThreadView;
|
|
78
|
+
}
|