@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
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x24ba=['plugins','writer','activeMarkers','push','schema','getAttribute','getWalker','isAtEnd','ck-suggestion-marker--active','mapper','addClass','isContent','consumable','name','element','nextSibling','createUIElement','test','insert','type','elementEnd','get','markerName','getItems','isLimit','createRangeOn','toViewPosition','includes','parent','markerRange','previousPosition','listItem','item','getCustomProperty'];(function(_0x573cd9,_0x24ba71){const _0x4920d1=function(_0x42eb05){while(--_0x42eb05){_0x573cd9['push'](_0x573cd9['shift']());}};_0x4920d1(++_0x24ba71);}(_0x24ba,0x1d2));const _0x4920=function(_0x573cd9,_0x24ba71){_0x573cd9=_0x573cd9-0x0;let _0x4920d1=_0x24ba[_0x573cd9];return _0x4920d1;};export function getRangesWithAttribute(_0x417211,_0x1f5a50,_0xd96e01){const _0x1bb612=[];for(const _0x2a5d75 of _0x1f5a50[_0x4920('0x21')]())_0x2a5d75['hasAttribute'](_0x417211)&&_0x1bb612[_0x4920('0xd')](_0xd96e01[_0x4920('0x1')](_0x2a5d75));return _0x1bb612;}export function getElementsAffectedByListItemRename(_0x4775ac){const _0xcf7fb3=[];if(_0x4775ac['is'](_0x4920('0x18'),_0x4920('0x7'))){let _0x4a20a1=_0x4775ac[_0x4920('0x19')];for(;_0x4a20a1&&_0x4a20a1['is'](_0x4920('0x18'),_0x4920('0x7'))&&_0x4a20a1[_0x4920('0xf')]('listIndent')>0x0;)_0xcf7fb3[_0x4920('0xd')](_0x4a20a1),_0x4a20a1=_0x4a20a1['nextSibling'];}return _0xcf7fb3;}export function downcastSplitMergeMarker(_0x1320f8,_0x875cd6,{showActiveMarker:_0x54e40b=!0x0}={}){const _0x1aad58=_0x1320f8[_0x4920('0xa')][_0x4920('0x1f')]('TrackChangesEditing');return(_0x2f42e2,_0x33a0cc,_0x2312db)=>{if(!_0x2312db[_0x4920('0x16')][_0x4920('0x1b')](_0x33a0cc['markerRange'],_0x2f42e2[_0x4920('0x17')]))return;const _0x5887da=_0x33a0cc[_0x4920('0x5')][_0x4920('0x10')](),_0x4146d3=_0x33a0cc[_0x4920('0x5')]['start'],_0x3a9cde=_0x1320f8['model'][_0x4920('0xe')];let _0x4d1db5=null,_0x4f7b9f=null,_0x596b7f=!0x1,_0x5a4591=!0x1;for(const _0x408a3c of _0x5887da){const _0x4b44cc=_0x408a3c[_0x4920('0x8')];_0x596b7f=_0x596b7f||_0x3a9cde[_0x4920('0x15')](_0x4b44cc);const _0x342862=_0x2312db[_0x4920('0x13')]['toViewElement'](_0x4b44cc);if(_0x342862&&_0x342862[_0x4920('0x9')]('addHighlight'))return;_0x4920('0x1e')==_0x408a3c[_0x4920('0x1d')]&&(_0x3a9cde['isBlock'](_0x4b44cc)&&!_0x3a9cde[_0x4920('0x0')](_0x4b44cc)&&(_0x4b44cc[_0x4920('0x19')]||_0x4146d3[_0x4920('0x11')]?_0x4d1db5&&_0x4d1db5[_0x4920('0x4')]==_0x4b44cc||(_0x4d1db5=_0x4b44cc,_0x527016(_0x408a3c[_0x4920('0x6')]),_0x5a4591=!0x0):_0x4f7b9f=_0x4f7b9f||_0x408a3c[_0x4920('0x6')]));}function _0x527016(_0x4d97fa){const _0x96e38d=_0x2312db[_0x4920('0xb')][_0x4920('0x1a')]('span',{'class':'ck-suggestion-marker-'+_0x875cd6}),_0x2db5df=_0x2312db[_0x4920('0x13')][_0x4920('0x2')](_0x4d97fa);_0x54e40b&&_0x1aad58[_0x4920('0xc')][_0x4920('0x3')](_0x33a0cc[_0x4920('0x20')])&&_0x2312db['writer'][_0x4920('0x14')](_0x4920('0x12'),_0x96e38d),_0x2312db[_0x4920('0xb')][_0x4920('0x1c')](_0x2db5df,_0x96e38d),_0x2312db[_0x4920('0x13')]['bindElementToMarker'](_0x96e38d,_0x33a0cc[_0x4920('0x20')]);}_0x596b7f||_0x5a4591||!_0x4f7b9f||_0x527016(_0x4f7b9f);};}
|
package/src/suggestion.d.ts
CHANGED
|
@@ -1,276 +1,291 @@
|
|
|
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/suggestion
|
|
7
|
-
* @publicApi
|
|
8
|
-
*/
|
|
9
|
-
import { Element, type Marker, type Model, type Range, type Item } from 'ckeditor5/src/engine';
|
|
10
|
-
import type { User } from 'ckeditor5-collaboration/src/collaboration-core';
|
|
11
|
-
import type { CommentThread } from '@ckeditor/ckeditor5-comments';
|
|
12
|
-
import type { FormatData } from './trackchangesediting';
|
|
13
|
-
declare const Suggestion_base: {
|
|
14
|
-
new (): import("ckeditor5/src/utils").Observable;
|
|
15
|
-
prototype: import("ckeditor5/src/utils").Observable;
|
|
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
|
-
* The
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
*
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* @observable
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
*
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* @observable
|
|
102
|
-
*/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
*
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
*
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*/
|
|
125
|
-
get
|
|
126
|
-
/**
|
|
127
|
-
*
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
*
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
* and
|
|
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
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
*
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
*
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
* ```ts
|
|
212
|
-
* suggestion.setAttribute( '
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
* suggestion.
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* ```
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*/
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
*
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
type: string;
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
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/suggestion
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { Element, type Marker, type Model, type Range, type Item } from 'ckeditor5/src/engine';
|
|
10
|
+
import type { User } from 'ckeditor5-collaboration/src/collaboration-core';
|
|
11
|
+
import type { CommentThread } from '@ckeditor/ckeditor5-comments';
|
|
12
|
+
import type { FormatData, AttributeData } from './trackchangesediting';
|
|
13
|
+
declare const Suggestion_base: {
|
|
14
|
+
new (): import("ckeditor5/src/utils").Observable;
|
|
15
|
+
prototype: import("ckeditor5/src/utils").Observable;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Represents a singular suggestion that is tracked by track changes plugin.
|
|
19
|
+
*
|
|
20
|
+
* `Suggestion` instances are created and handled by {@link module:track-changes/trackchanges~TrackChanges track changes plugin}.
|
|
21
|
+
*/
|
|
22
|
+
export default class Suggestion extends Suggestion_base {
|
|
23
|
+
/**
|
|
24
|
+
* Suggestion ID.
|
|
25
|
+
*/
|
|
26
|
+
readonly id: string;
|
|
27
|
+
/**
|
|
28
|
+
* Suggestion type.
|
|
29
|
+
*/
|
|
30
|
+
type: SuggestionType;
|
|
31
|
+
/**
|
|
32
|
+
* Suggestion sub-type.
|
|
33
|
+
*
|
|
34
|
+
* This is an additional identifier for suggestions. Two suggestions of the same type may have different sub-types to differentiate
|
|
35
|
+
* suggestions behavior and handle interactions between suggestions.
|
|
36
|
+
*
|
|
37
|
+
* Sub-type is used for:
|
|
38
|
+
*
|
|
39
|
+
* * suggestions joining (only suggestions with the same sub-type can be joined),
|
|
40
|
+
* * suggestions custom callbacks (fired when adding, deleting and joining suggestions).
|
|
41
|
+
*/
|
|
42
|
+
subType: string | null;
|
|
43
|
+
/**
|
|
44
|
+
* The author of the change marked by the suggestion.
|
|
45
|
+
*/
|
|
46
|
+
author: User;
|
|
47
|
+
/**
|
|
48
|
+
* The user which saved the suggestion data in the database.
|
|
49
|
+
*
|
|
50
|
+
* Usually the same as author but may be different in some cases (e.g. when suggestion was added from an external source).
|
|
51
|
+
*/
|
|
52
|
+
creator: User;
|
|
53
|
+
/**
|
|
54
|
+
* The flag indicating whether the suggestion comes from an external source.
|
|
55
|
+
*/
|
|
56
|
+
isExternal: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Additional suggestion data.
|
|
59
|
+
*/
|
|
60
|
+
data: FormatData | AttributeData | null;
|
|
61
|
+
/**
|
|
62
|
+
* Date when the suggestion was saved in the database.
|
|
63
|
+
*/
|
|
64
|
+
createdAt: Date | null;
|
|
65
|
+
/**
|
|
66
|
+
* Date when the change marked by the suggestion was made.
|
|
67
|
+
*
|
|
68
|
+
* Usually the same as {@link #createdAt `createdAt`} but may be different in some cases
|
|
69
|
+
* (e.g. when suggestion was added from an external source).
|
|
70
|
+
*
|
|
71
|
+
* @observable
|
|
72
|
+
*/
|
|
73
|
+
authoredAt: Date | null;
|
|
74
|
+
/**
|
|
75
|
+
* Custom suggestion attributes. See also {@link #setAttribute} and {@link #removeAttribute}.
|
|
76
|
+
*
|
|
77
|
+
* @observable
|
|
78
|
+
*/
|
|
79
|
+
attributes: {
|
|
80
|
+
[k: string]: unknown;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Previous suggestion in suggestions chain.
|
|
84
|
+
*
|
|
85
|
+
* Chained suggestions should be handled as one entity.
|
|
86
|
+
*
|
|
87
|
+
* @observable
|
|
88
|
+
*/
|
|
89
|
+
previous: Suggestion | null;
|
|
90
|
+
/**
|
|
91
|
+
* Next suggestion in suggestions chain.
|
|
92
|
+
*
|
|
93
|
+
* Chained suggestions should be handled as one entity.
|
|
94
|
+
*
|
|
95
|
+
* @observable
|
|
96
|
+
*/
|
|
97
|
+
next: Suggestion | null;
|
|
98
|
+
/**
|
|
99
|
+
* Comment thread model for comments added to this suggestion.
|
|
100
|
+
*
|
|
101
|
+
* @observable
|
|
102
|
+
*/
|
|
103
|
+
commentThread: CommentThread | null;
|
|
104
|
+
constructor(model: Model, options: SuggestionOptions);
|
|
105
|
+
/**
|
|
106
|
+
* The first (most-previous) suggestion in this suggestion chain.
|
|
107
|
+
*/
|
|
108
|
+
get head(): Suggestion;
|
|
109
|
+
/**
|
|
110
|
+
* Informs whether suggestion has at least one comment.
|
|
111
|
+
*/
|
|
112
|
+
get hasComments(): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Informs whether the suggestion is a multi-range suggestion or a single-range suggestion.
|
|
115
|
+
*
|
|
116
|
+
* This is evaluated basing on the marker name belonging to this suggestion.
|
|
117
|
+
* Even if only one marker belongs to the suggestion at a given time it can still be a multi range suggestion.
|
|
118
|
+
*/
|
|
119
|
+
get isMultiRange(): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Informs whether the suggestion is still in the editor content.
|
|
122
|
+
*
|
|
123
|
+
* Returns `true` if there is at least one marker suggestion in the editor content.
|
|
124
|
+
*/
|
|
125
|
+
get isInContent(): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Binds given marker name to this suggestion.
|
|
128
|
+
*/
|
|
129
|
+
addMarkerName(markerName: string): void;
|
|
130
|
+
/**
|
|
131
|
+
* Returns all names of markers belonging to this suggestion.
|
|
132
|
+
*/
|
|
133
|
+
getMarkerNames(): Array<string>;
|
|
134
|
+
/**
|
|
135
|
+
* Returns all markers belonging to this suggestion.
|
|
136
|
+
*/
|
|
137
|
+
getMarkers(): Array<Marker>;
|
|
138
|
+
/**
|
|
139
|
+
* Returns the first marker belonging to this suggestion, i.e the first marker that was added to this suggestion
|
|
140
|
+
* and not removed yet.
|
|
141
|
+
*
|
|
142
|
+
* This method is useful if you know that the suggestion has only one marker and want to process it.
|
|
143
|
+
*/
|
|
144
|
+
getFirstMarker(): Marker | null;
|
|
145
|
+
/**
|
|
146
|
+
* Removes all markers from the suggestion and the editor content.
|
|
147
|
+
*/
|
|
148
|
+
removeMarkers(): void;
|
|
149
|
+
/**
|
|
150
|
+
* Removes marker with the given name from the suggestion and the editor content.
|
|
151
|
+
*/
|
|
152
|
+
removeMarker(markerName: string): void;
|
|
153
|
+
/**
|
|
154
|
+
* Adds a new range to this suggestion. It is assumed that the suggestion is a multi-range suggestion.
|
|
155
|
+
*
|
|
156
|
+
* A marker name is generated from this suggestion's properties and a marker with that name is created and set to a given `range`.
|
|
157
|
+
*/
|
|
158
|
+
addRange(range: Range): void;
|
|
159
|
+
/**
|
|
160
|
+
* Checks if given `range` is intersecting with any of the ranges of markers belonging to this suggestion.
|
|
161
|
+
*/
|
|
162
|
+
isIntersectingWithRange(range: Range): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Returns all ranges of all markers belonging to this suggestion.
|
|
165
|
+
*/
|
|
166
|
+
getRanges(): Array<Range>;
|
|
167
|
+
/**
|
|
168
|
+
* Returns all {@link module:engine/model/item~Item model items} that are in this suggestion.
|
|
169
|
+
*/
|
|
170
|
+
getItems(): Array<Item>;
|
|
171
|
+
/**
|
|
172
|
+
* Returns the first range belonging to this suggestion, i.e. the range of the first marker that was added to
|
|
173
|
+
* this suggestion and not removed yet.
|
|
174
|
+
*
|
|
175
|
+
* This method is useful if you know that the suggestion has only one marker and want to process its range.
|
|
176
|
+
*/
|
|
177
|
+
getFirstRange(): Range | null;
|
|
178
|
+
/**
|
|
179
|
+
* Returns the model element contained in the suggestion.
|
|
180
|
+
*
|
|
181
|
+
* A {@link module:engine/model/element~Element model element} is considered as contained if there is exactly
|
|
182
|
+
* one range in the suggestion, and that range contains exactly one element.
|
|
183
|
+
*
|
|
184
|
+
* Returns `null` if there is no contained element.
|
|
185
|
+
*/
|
|
186
|
+
getContainedElement(): Element | null;
|
|
187
|
+
/**
|
|
188
|
+
* Accepts the suggestion.
|
|
189
|
+
*/
|
|
190
|
+
accept(): void;
|
|
191
|
+
/**
|
|
192
|
+
* Discards the suggestion.
|
|
193
|
+
*/
|
|
194
|
+
discard(): void;
|
|
195
|
+
/**
|
|
196
|
+
* Returns all suggestions that are in this suggestion chain.
|
|
197
|
+
*/
|
|
198
|
+
getAllAdjacentSuggestions(): Array<Suggestion>;
|
|
199
|
+
/**
|
|
200
|
+
* Adds suggestion attribute.
|
|
201
|
+
*
|
|
202
|
+
* Suggestion attributes are custom data that can be set and used by features
|
|
203
|
+
* built around suggestions. Use it to store your feature data with other suggestion data.
|
|
204
|
+
*
|
|
205
|
+
* ```ts
|
|
206
|
+
* suggestion.setAttribute( 'isImportant', true );
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* You can group multiple values in an object, using dot notation:
|
|
210
|
+
*
|
|
211
|
+
* ```ts
|
|
212
|
+
* suggestion.setAttribute( 'customData.type', 'image' );
|
|
213
|
+
* suggestion.setAttribute( 'customData.src', 'foo.jpg' );
|
|
214
|
+
* ```
|
|
215
|
+
*
|
|
216
|
+
* Attributes set on the suggestion can be accessed through `attribute` property:
|
|
217
|
+
*
|
|
218
|
+
* ```ts
|
|
219
|
+
* const isImportant = suggestion.attributes.isImportant;
|
|
220
|
+
* const type = suggestion.attributes.customData.type;
|
|
221
|
+
* ```
|
|
222
|
+
*
|
|
223
|
+
* You can also observe `attributes` property or bind other properties to it:
|
|
224
|
+
*
|
|
225
|
+
* ```ts
|
|
226
|
+
* myObj.bind( 'customData' ).to( suggestion, 'attributes', attributes => attributes.customData );
|
|
227
|
+
* ```
|
|
228
|
+
*
|
|
229
|
+
* Whenever `setAttribute()` or `removeAttribute()` is called, `attributes` property
|
|
230
|
+
* is re-set and observables are refreshed.
|
|
231
|
+
*/
|
|
232
|
+
setAttribute(name: string, value: unknown): void;
|
|
233
|
+
/**
|
|
234
|
+
* Removes suggestion attribute.
|
|
235
|
+
*
|
|
236
|
+
* See also {@link #setAttribute}
|
|
237
|
+
*/
|
|
238
|
+
removeAttribute(name: string): void;
|
|
239
|
+
toJSON(): SuggestionJSON;
|
|
240
|
+
/**
|
|
241
|
+
* Returns a random string that can be used as additional identifier for the marker name for suggestions that are multi range.
|
|
242
|
+
*/
|
|
243
|
+
static getMultiRangeId(): string;
|
|
244
|
+
}
|
|
245
|
+
export interface SuggestionOptions {
|
|
246
|
+
id: string;
|
|
247
|
+
type: SuggestionType;
|
|
248
|
+
subType: string | null;
|
|
249
|
+
attributes: {
|
|
250
|
+
[k: string]: unknown;
|
|
251
|
+
};
|
|
252
|
+
author: User;
|
|
253
|
+
creator: User;
|
|
254
|
+
onAccept: Function;
|
|
255
|
+
onDiscard: Function;
|
|
256
|
+
onAttributesChange: Function;
|
|
257
|
+
}
|
|
258
|
+
export interface SuggestionJSON {
|
|
259
|
+
/**
|
|
260
|
+
* Suggestion ID.
|
|
261
|
+
*/
|
|
262
|
+
id: string;
|
|
263
|
+
/**
|
|
264
|
+
* Contains the information about the type and subtype of the suggestion.
|
|
265
|
+
*/
|
|
266
|
+
type: string;
|
|
267
|
+
/**
|
|
268
|
+
* The ID of the author.
|
|
269
|
+
*/
|
|
270
|
+
authorId: string;
|
|
271
|
+
/**
|
|
272
|
+
* Date when the suggestion was saved in the database.
|
|
273
|
+
*/
|
|
274
|
+
createdAt: Date | null;
|
|
275
|
+
/**
|
|
276
|
+
* Informs whether suggestion has at least one comment.
|
|
277
|
+
*/
|
|
278
|
+
hasComments?: boolean;
|
|
279
|
+
/**
|
|
280
|
+
* Additional suggestion data.
|
|
281
|
+
*/
|
|
282
|
+
data?: FormatData | AttributeData | null;
|
|
283
|
+
/**
|
|
284
|
+
* Custom suggestion attributes.
|
|
285
|
+
*/
|
|
286
|
+
attributes: {
|
|
287
|
+
[k: string]: unknown;
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
export type SuggestionType = 'insertion' | 'deletion' | 'formatInline' | 'formatBlock' | 'attribute';
|
|
291
|
+
export {};
|