@ckeditor/ckeditor5-track-changes 38.1.0 → 38.1.1

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