@ckeditor/ckeditor5-track-changes 48.2.0 → 48.3.0-alpha.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/dist/augmentation.d.ts +42 -42
- package/dist/commands/acceptsuggestioncommand.d.ts +19 -19
- package/dist/commands/discardsuggestioncommand.d.ts +19 -19
- package/dist/commands/executeonallsuggestionscommand.d.ts +19 -19
- package/dist/commands/executeonselectedsuggestionscommand.d.ts +19 -19
- package/dist/commands/previewfinalcontentcommand.d.ts +21 -21
- package/dist/commands/trackchangescommand.d.ts +21 -21
- package/dist/index.d.ts +23 -23
- package/dist/index.js +4 -4
- package/dist/integrations/ai.d.ts +12 -12
- package/dist/integrations/aiassistant.d.ts +12 -12
- package/dist/integrations/aiquickactions.d.ts +12 -12
- package/dist/integrations/alignment.d.ts +12 -12
- package/dist/integrations/basicstyles.d.ts +12 -12
- package/dist/integrations/blockquote.d.ts +12 -12
- package/dist/integrations/bookmark.d.ts +12 -12
- package/dist/integrations/casechange.d.ts +12 -12
- package/dist/integrations/ckbox.d.ts +12 -12
- package/dist/integrations/codeblock.d.ts +12 -12
- package/dist/integrations/comments.d.ts +9 -9
- package/dist/integrations/deletecommand.d.ts +12 -12
- package/dist/integrations/emoji.d.ts +12 -12
- package/dist/integrations/entercommand.d.ts +11 -11
- package/dist/integrations/findandreplace.d.ts +16 -16
- package/dist/integrations/font.d.ts +12 -12
- package/dist/integrations/footnotes.d.ts +12 -12
- package/dist/integrations/formatpainter.d.ts +12 -12
- package/dist/integrations/generalhtmlsupport.d.ts +24 -24
- package/dist/integrations/heading.d.ts +12 -12
- package/dist/integrations/highlight.d.ts +12 -12
- package/dist/integrations/horizontalline.d.ts +12 -12
- package/dist/integrations/htmlembed.d.ts +12 -12
- package/dist/integrations/image.d.ts +12 -12
- package/dist/integrations/imagereplace.d.ts +12 -12
- package/dist/integrations/imagestyle.d.ts +12 -12
- package/dist/integrations/importword.d.ts +13 -13
- package/dist/integrations/indent.d.ts +12 -12
- package/dist/integrations/inputcommand.d.ts +11 -11
- package/dist/integrations/legacylist.d.ts +12 -12
- package/dist/integrations/legacylistproperties.d.ts +24 -24
- package/dist/integrations/lineheight.d.ts +12 -12
- package/dist/integrations/link.d.ts +12 -12
- package/dist/integrations/list.d.ts +12 -12
- package/dist/integrations/listproperties.d.ts +15 -15
- package/dist/integrations/mediaembed.d.ts +12 -12
- package/dist/integrations/mediaembedstyle.d.ts +13 -13
- package/dist/integrations/mention.d.ts +12 -12
- package/dist/integrations/mergefields.d.ts +12 -12
- package/dist/integrations/multilevellist.d.ts +19 -19
- package/dist/integrations/pagebreak.d.ts +12 -12
- package/dist/integrations/paragraph.d.ts +12 -12
- package/dist/integrations/removeformat.d.ts +12 -12
- package/dist/integrations/replacesourcecommand.d.ts +13 -13
- package/dist/integrations/restrictededitingmode.d.ts +12 -12
- package/dist/integrations/shiftentercommand.d.ts +9 -9
- package/dist/integrations/standardeditingmode.d.ts +12 -12
- package/dist/integrations/style.d.ts +29 -29
- package/dist/integrations/table.d.ts +34 -34
- package/dist/integrations/tablecaption.d.ts +17 -17
- package/dist/integrations/tableclipboard.d.ts +15 -15
- package/dist/integrations/tablecolumnresize.d.ts +21 -21
- package/dist/integrations/tablefooters.d.ts +17 -17
- package/dist/integrations/tableheadings.d.ts +17 -17
- package/dist/integrations/tablelayout.d.ts +12 -12
- package/dist/integrations/tablemergesplit.d.ts +17 -17
- package/dist/integrations/tableofcontents.d.ts +12 -12
- package/dist/integrations/tableproperties.d.ts +30 -30
- package/dist/integrations/template.d.ts +12 -12
- package/dist/integrations/title.d.ts +12 -12
- package/dist/integrations/undo.d.ts +12 -12
- package/dist/integrations/uploadcare.d.ts +12 -12
- package/dist/integrations/utils.d.ts +8 -8
- package/dist/suggestion.d.ts +285 -283
- package/dist/suggestiondescriptionfactory.d.ts +165 -165
- package/dist/trackchanges.d.ts +178 -178
- package/dist/trackchangesconfig.d.ts +136 -103
- package/dist/trackchangesdata.d.ts +59 -59
- package/dist/trackchangesediting.d.ts +565 -565
- package/dist/trackchangespreview.d.ts +26 -26
- package/dist/trackchangesui.d.ts +52 -52
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/dist/ui/suggestioncontroller.d.ts +34 -33
- package/dist/ui/view/basesuggestionthreadview.d.ts +192 -191
- package/dist/ui/view/suggestionthreadview.d.ts +89 -89
- package/dist/ui/view/suggestionview.d.ts +219 -183
- package/dist/ui/view/trackchangespreviewview.d.ts +0 -4
- package/dist/utils/common-translations.d.ts +6 -6
- package/dist/utils/utils.d.ts +23 -23
- package/package.json +25 -25
package/dist/trackchanges.d.ts
CHANGED
|
@@ -1,189 +1,189 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { Plugin } from
|
|
10
|
-
import { Comments } from
|
|
11
|
-
import { TrackChangesUI } from
|
|
12
|
-
import { TrackChangesEditing } from
|
|
13
|
-
import
|
|
14
|
-
import type { Suggestion, SuggestionJSON } from
|
|
6
|
+
* @module track-changes/trackchanges
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
10
|
+
import { Comments } from "@ckeditor/ckeditor5-comments";
|
|
11
|
+
import { TrackChangesUI } from "./trackchangesui.js";
|
|
12
|
+
import { TrackChangesEditing } from "./trackchangesediting.js";
|
|
13
|
+
import "@ckeditor/ckeditor5-collaboration-core";
|
|
14
|
+
import type { Suggestion, SuggestionJSON } from "./suggestion.js";
|
|
15
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
16
|
+
* A plugin that provides track changes mode for the editor. In track changes mode, all insertions are visually marked and all deletions
|
|
17
|
+
* are not deleted but also visually marked. Unsupported commands are disabled when the editor is in the track changes mode.
|
|
18
|
+
*
|
|
19
|
+
* To learn how to integrate the track changes feature with your editor, refer to the
|
|
20
|
+
* {@glink features/collaboration/track-changes/track-changes-integration Track changes integration} guide.
|
|
21
|
+
*
|
|
22
|
+
* Basic API:
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* // Get the track changes plugin:
|
|
26
|
+
* const trackChangesPlugin = editor.plugins.get( 'TrackChanges' );
|
|
27
|
+
*
|
|
28
|
+
* // Add a suggestion:
|
|
29
|
+
* trackChangesPlugin.addSuggestion( suggestionData );
|
|
30
|
+
*
|
|
31
|
+
* // Get all suggestions:
|
|
32
|
+
* trackChangesPlugin.getSuggestions();
|
|
33
|
+
*
|
|
34
|
+
* // Set the adapter:
|
|
35
|
+
* trackChangesPlugin.adapter = {
|
|
36
|
+
* // ...
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* The plugin registers several commands:
|
|
41
|
+
*
|
|
42
|
+
* * `trackChanges` – Toggles the track changes mode in the editor.
|
|
43
|
+
* * `acceptSuggestion` – Accepts a suggestion with the specified ID.
|
|
44
|
+
* * `discardSuggestion` – Discards a suggestion with the specified ID.
|
|
45
|
+
* * `acceptAllSuggestions` – Accepts all suggestions.
|
|
46
|
+
* * `discardAllSuggestions` – Discards all suggestions.
|
|
47
|
+
* * `acceptSelectedSuggestions` – Accepts all suggestions in the current selection.
|
|
48
|
+
* * `discardSelectedSuggestions` – Discards all suggestions in the current selection.
|
|
49
|
+
*
|
|
50
|
+
* Examples:
|
|
51
|
+
*
|
|
52
|
+
* ```ts
|
|
53
|
+
* editor.execute( 'trackChanges' );
|
|
54
|
+
* editor.execute( 'acceptSuggestion', 'suggestion-1' );
|
|
55
|
+
* editor.execute( 'discardSuggestion', 'suggestion-1' );
|
|
56
|
+
* editor.execute( 'acceptAllSuggestions' );
|
|
57
|
+
* editor.execute( 'discardAllSuggestions' );
|
|
58
|
+
* editor.execute( 'acceptSelectedSuggestions' );
|
|
59
|
+
* editor.execute( 'discardSelectedSuggestions' )
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* Note that there is no command to add a suggestion. This is because suggestions
|
|
63
|
+
* are added automatically when editing commands are executed while the editor is in track
|
|
64
|
+
* changes mode. For instance:
|
|
65
|
+
*
|
|
66
|
+
* ```ts
|
|
67
|
+
* // Turn on the track changes mode:
|
|
68
|
+
* editor.execute( 'trackChanges' );
|
|
69
|
+
*
|
|
70
|
+
* // Insert some text. It will be automatically inserted as a suggestion:
|
|
71
|
+
* editor.execute( 'input', { text: 'foo' } );
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
74
|
export declare class TrackChanges extends Plugin {
|
|
75
|
-
|
|
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
|
-
|
|
75
|
+
static get requires(): PluginDependenciesOf<[TrackChangesEditing, TrackChangesUI, Comments]>;
|
|
76
|
+
static get pluginName(): "TrackChanges";
|
|
77
|
+
/**
|
|
78
|
+
* @inheritDoc
|
|
79
|
+
*/
|
|
80
|
+
static override get isOfficialPlugin(): true;
|
|
81
|
+
/**
|
|
82
|
+
* @inheritDoc
|
|
83
|
+
*/
|
|
84
|
+
static override get isPremiumPlugin(): true;
|
|
85
|
+
/**
|
|
86
|
+
* An adapter object that should communicate with the data source to fetch or save the suggestion data.
|
|
87
|
+
*
|
|
88
|
+
* This is a shorthand to {@link module:track-changes/trackchangesediting~TrackChangesEditing#adapter `TrackChangesEditing#adapter`}.
|
|
89
|
+
*/
|
|
90
|
+
set adapter(adapter: TrackChangesAdapter | null);
|
|
91
|
+
get adapter(): TrackChangesAdapter | null;
|
|
92
|
+
/**
|
|
93
|
+
* Adds suggestion data.
|
|
94
|
+
*
|
|
95
|
+
* Use this method to load the suggestion data during the editor initialization if you do not use the adapter integration.
|
|
96
|
+
*/
|
|
97
|
+
addSuggestion(suggestionData: SuggestionData): Suggestion;
|
|
98
|
+
getSuggestions(options: {
|
|
99
|
+
skipNotAttached?: boolean;
|
|
100
|
+
toJSON: true;
|
|
101
|
+
}): Array<SuggestionJSON>;
|
|
102
|
+
getSuggestions(options?: {
|
|
103
|
+
skipNotAttached?: boolean;
|
|
104
|
+
toJSON?: false;
|
|
105
|
+
}): Array<Suggestion>;
|
|
106
|
+
getSuggestions(options: {
|
|
107
|
+
skipNotAttached?: boolean;
|
|
108
|
+
toJSON: boolean;
|
|
109
|
+
}): Array<Suggestion> | Array<SuggestionJSON>;
|
|
110
|
+
/**
|
|
111
|
+
* Returns the suggestion instance for a given ID.
|
|
112
|
+
*/
|
|
113
|
+
getSuggestion(id: string): Suggestion;
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
* Track changes adapter.
|
|
117
|
+
*
|
|
118
|
+
* The track changes adapter is an object that communicates asynchronously with the data source to fetch or save the suggestion data.
|
|
119
|
+
* It is used internally by the track changes feature whenever a suggestion is loaded, created or deleted.
|
|
120
|
+
*
|
|
121
|
+
* The adapter is optional. You might need to provide it if you are {@glink features/collaboration/track-changes/track-changes-integration}
|
|
122
|
+
* using the track changes feature without real-time collaboration.
|
|
123
|
+
*
|
|
124
|
+
* To set the adapter, overwrite {@link module:track-changes/trackchanges~TrackChanges#adapter the `TrackChanges#adapter` property}.
|
|
125
|
+
*/
|
|
126
126
|
export interface TrackChangesAdapter {
|
|
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
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Called each time the suggestion data is needed.
|
|
129
|
+
*
|
|
130
|
+
* The method should return a promise that resolves with the suggestion data object.
|
|
131
|
+
*
|
|
132
|
+
* @param id The ID of the suggestion to get.
|
|
133
|
+
*/
|
|
134
|
+
getSuggestion(id: string): Promise<SuggestionData>;
|
|
135
|
+
/**
|
|
136
|
+
* Called each time a new suggestion is created.
|
|
137
|
+
*
|
|
138
|
+
* The method should save the suggestion data in the database
|
|
139
|
+
* and return a promise that should be resolved when the save is
|
|
140
|
+
* completed.
|
|
141
|
+
*
|
|
142
|
+
* If the promise resolves with an object with the `createdAt` property,
|
|
143
|
+
* this suggestion property will be updated in the suggestion in the editor.
|
|
144
|
+
* This lets you update the suggestion data with server-side information.
|
|
145
|
+
*
|
|
146
|
+
* The `suggestionData` object does not expect the `authorId` property.
|
|
147
|
+
* For security reasons, the author of the suggestion should be set
|
|
148
|
+
* on the server side.
|
|
149
|
+
*
|
|
150
|
+
* If `suggestionData.originalSuggestionId` is set, the new suggestion should
|
|
151
|
+
* have the `authorId` property set to the same as the suggestion with
|
|
152
|
+
* `originalSuggestionId`. This happens when one user splits
|
|
153
|
+
* another user's suggestion, creating a new suggestion as a result. See
|
|
154
|
+
* {@glink features/collaboration/track-changes/track-changes-integration#implementation Track changes integration} guide.
|
|
155
|
+
*
|
|
156
|
+
* **Note:** Failure to properly handle this property will result in editor crash in some scenarios.
|
|
157
|
+
*
|
|
158
|
+
* In any other case, use the current (local) user to set `authorId`.
|
|
159
|
+
*
|
|
160
|
+
* The `suggestionData` object does not expect the `createdAt` property either.
|
|
161
|
+
* You should use the server-side time generator to ensure that all users
|
|
162
|
+
* see the same date.
|
|
163
|
+
*
|
|
164
|
+
* It is recommended to stringify `suggestionData.attributes` value to JSON and save it as a string in your database,
|
|
165
|
+
* and then to parse the strings when loading suggestions.
|
|
166
|
+
*/
|
|
167
|
+
addSuggestion(suggestionData: AddSuggestionInput): Promise<SuggestionData>;
|
|
168
|
+
/**
|
|
169
|
+
* Called each time the suggestion properties change.
|
|
170
|
+
*
|
|
171
|
+
* The method should update the suggestion properties in the database
|
|
172
|
+
* and return a promise that should be resolved when the save is
|
|
173
|
+
* completed.
|
|
174
|
+
*
|
|
175
|
+
* Keep in mind that the `data` parameter only contains those
|
|
176
|
+
* properties of a suggestion which changed.
|
|
177
|
+
*/
|
|
178
|
+
updateSuggestion(id: string, suggestionData: UpdateSuggestionInput): Promise<void>;
|
|
179
179
|
}
|
|
180
180
|
export interface SuggestionData extends SuggestionJSON {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
181
|
+
/**
|
|
182
|
+
* Original suggestion ID from which the current one was split.
|
|
183
|
+
*/
|
|
184
|
+
originalSuggestionId?: string | null;
|
|
185
185
|
}
|
|
186
|
-
export type AddSuggestionInput = Omit<SuggestionData,
|
|
187
|
-
export type UpdateSuggestionInput = Partial<Pick<SuggestionJSON,
|
|
188
|
-
|
|
186
|
+
export type AddSuggestionInput = Omit<SuggestionData, "authorId" | "createdAt">;
|
|
187
|
+
export type UpdateSuggestionInput = Partial<Pick<SuggestionJSON, "hasComments" | "attributes">> & {
|
|
188
|
+
state?: "open" | "accepted" | "rejected";
|
|
189
189
|
};
|
|
@@ -1,110 +1,143 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { type SuggestionThreadView } from
|
|
10
|
-
import { type SuggestionView } from
|
|
6
|
+
* @module track-changes/trackchangesconfig
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { type SuggestionThreadView } from "./ui/view/suggestionthreadview.js";
|
|
10
|
+
import { type SuggestionView } from "./ui/view/suggestionview.js";
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
12
|
+
* The configuration of the track changes feature.
|
|
13
|
+
*
|
|
14
|
+
* Example:
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* ClassicEditor
|
|
18
|
+
* .create( {
|
|
19
|
+
* // Track changes feature configuration.
|
|
20
|
+
* trackChanges: {
|
|
21
|
+
* // Do not allow users to comment suggestions (default is `false`).
|
|
22
|
+
* disableComments: true,
|
|
23
|
+
* // Do not track styling and formatting changes (default is `default`).
|
|
24
|
+
* trackFormatChanges: 'never',
|
|
25
|
+
* // Merges suggestion changes inside a block. (default is `true`).
|
|
26
|
+
* mergeNestedSuggestions: true
|
|
27
|
+
* }
|
|
28
|
+
* } )
|
|
29
|
+
* .then( ... )
|
|
30
|
+
* .catch( ... );
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
34
|
+
*/
|
|
35
35
|
export interface TrackChangesConfig {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
36
|
+
/**
|
|
37
|
+
* A property that specifies if the comments for suggestions are enabled or disabled.
|
|
38
|
+
* When the option is set to `true`, the comment thread UI for suggestions will be hidden
|
|
39
|
+
* and commenting suggestions will be disabled.
|
|
40
|
+
*
|
|
41
|
+
* Suggestion thread views will be marked with the additional `ck-suggestion--disabled-comments` class when the suggestion comments
|
|
42
|
+
* are disabled.
|
|
43
|
+
*
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
disableComments?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* A property that specifies whether formatting changes should be tracked.
|
|
49
|
+
*
|
|
50
|
+
* Formatting changes are all changes other than insertions and deletions, including: styling, structure, widgets properties, etc.
|
|
51
|
+
*
|
|
52
|
+
* By default, formatting changes are tracked. However, if you make a formatting change inside your own insertion suggestion, it
|
|
53
|
+
* is immediately applied, without creating a suggestion.
|
|
54
|
+
*
|
|
55
|
+
* Possible values are:
|
|
56
|
+
*
|
|
57
|
+
* * `'default'` - format changes are tracked, but when made inside your own insertion suggestion, they will be immediately applied.
|
|
58
|
+
* * `'always'` - format changes will always be tracked, even inside your own insertion suggestion.
|
|
59
|
+
* * `'never'` - format changes will never be tracked (suggestions for such changes will not be created).
|
|
60
|
+
*
|
|
61
|
+
* @default 'default'
|
|
62
|
+
*/
|
|
63
|
+
trackFormatChanges?: "never" | "default" | "always";
|
|
64
|
+
/**
|
|
65
|
+
* Specifies whether suggestions on an object (e.g. image, table) should be automatically merged
|
|
66
|
+
* with suggestions inside the object (e.g. image caption, table cell).
|
|
67
|
+
*
|
|
68
|
+
* For example, when set to `true`, creating a table and writing some text inside the table will result in one suggestion.
|
|
69
|
+
* When set to `false`, it will be two separate suggestions, one for the inserted table and one for the inserted text.
|
|
70
|
+
*
|
|
71
|
+
* Keep in mind that only suggestions from the same author and of the same type are merged this way.
|
|
72
|
+
*
|
|
73
|
+
* @default true
|
|
74
|
+
*/
|
|
75
|
+
mergeNestedSuggestions?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* A view class to be used to create suggestion thread views.
|
|
78
|
+
*
|
|
79
|
+
* {@link module:track-changes/ui/view/suggestionthreadview~SuggestionThreadView} is used by default
|
|
80
|
+
* when this property is not set.
|
|
81
|
+
*/
|
|
82
|
+
SuggestionThreadView?: typeof SuggestionThreadView;
|
|
83
|
+
/**
|
|
84
|
+
* A view class to be used to create the suggestion view.
|
|
85
|
+
*
|
|
86
|
+
* {@link module:track-changes/ui/view/suggestionview~SuggestionView} is used by default when this property is not set.
|
|
87
|
+
*/
|
|
88
|
+
SuggestionView?: typeof SuggestionView;
|
|
89
|
+
/**
|
|
90
|
+
* Controls if and how the suggestion annotation displays information that the suggestion was generated by AI.
|
|
91
|
+
*
|
|
92
|
+
* Possible values:
|
|
93
|
+
*
|
|
94
|
+
* * `'pill'` - shows an "AI-generated" pill in the suggestion balloon while preserving the original author's identity.
|
|
95
|
+
* * `'author'` - swaps the author shown in the suggestion view (name + avatar) for a view-only AI identity.
|
|
96
|
+
* The original author's ID is still preserved in suggestion's data.
|
|
97
|
+
* The view-only identity can be customized via {@link #aiAuthor}.
|
|
98
|
+
* * `null` - the AI source is hidden (default).
|
|
99
|
+
*
|
|
100
|
+
* @default null
|
|
101
|
+
*/
|
|
102
|
+
showAISource?: "pill" | "author" | null;
|
|
103
|
+
/**
|
|
104
|
+
* The view-only identity used to render AI-sourced suggestions when {@link #showAISource} is set to `'author'`.
|
|
105
|
+
*
|
|
106
|
+
* This is a view-only override. The persisted author of the suggestion is not affected.
|
|
107
|
+
*
|
|
108
|
+
* Defaults to a built-in `AI Assistant` identity when this option is not provided.
|
|
109
|
+
*/
|
|
110
|
+
aiAuthor?: {
|
|
111
|
+
/**
|
|
112
|
+
* Display name used in the suggestion view.
|
|
113
|
+
*
|
|
114
|
+
* @default 'AI Assistant'
|
|
115
|
+
*/
|
|
116
|
+
name?: string;
|
|
117
|
+
/**
|
|
118
|
+
* URL to an avatar image. When not provided, a default AI icon is shown.
|
|
119
|
+
*/
|
|
120
|
+
avatar?: string;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Configuration of the track changes preview feature.
|
|
124
|
+
*/
|
|
125
|
+
preview?: TrackChangesPreviewConfig;
|
|
93
126
|
}
|
|
94
127
|
export interface TrackChangesPreviewConfig {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
128
|
+
/**
|
|
129
|
+
* A callback function that allows for modifying the structure of the
|
|
130
|
+
* {@link module:track-changes/trackchangespreview~TrackChangesPreview track changes preview} container.
|
|
131
|
+
*
|
|
132
|
+
* The callback receives the container element (`.ck-track-changes-preview`) and an array of root elements.
|
|
133
|
+
*
|
|
134
|
+
* * If the editor only has one root, there's only one element in the array.
|
|
135
|
+
* * If the editor has multiple roots, the there's one element per root. They are ordered either by `order`
|
|
136
|
+
* root attribute or, if it's not present, by DOM order.
|
|
137
|
+
*
|
|
138
|
+
* The callback should append all array elements to the container, but can also add custom classes, elements in between etc.
|
|
139
|
+
*
|
|
140
|
+
* The default callback simply appends all elements to the container in the order they are provided.
|
|
141
|
+
*/
|
|
142
|
+
renderFunction?: (container: HTMLElement, elements: Array<HTMLElement>) => void;
|
|
110
143
|
}
|