@ckeditor/ckeditor5-track-changes 39.0.1 → 40.0.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 +2 -2
- package/LICENSE.md +6 -6
- package/README.md +14 -14
- package/build/track-changes.js +1 -1
- package/lang/translations/ar.po +1 -0
- package/lang/translations/az.po +1 -0
- package/lang/translations/bg.po +1 -0
- package/lang/translations/bn.po +1 -0
- package/lang/translations/ca.po +1 -0
- package/lang/translations/cs.po +1 -0
- package/lang/translations/da.po +1 -0
- package/lang/translations/de.po +1 -0
- package/lang/translations/el.po +1 -0
- package/lang/translations/en-au.po +1 -0
- package/lang/translations/en.po +1 -0
- package/lang/translations/es.po +1 -0
- package/lang/translations/et.po +1 -0
- package/lang/translations/fi.po +1 -0
- package/lang/translations/fr.po +1 -0
- package/lang/translations/gl.po +1 -0
- package/lang/translations/he.po +1 -0
- package/lang/translations/hi.po +1 -0
- package/lang/translations/hr.po +1 -0
- package/lang/translations/hu.po +1 -0
- package/lang/translations/id.po +1 -0
- package/lang/translations/it.po +1 -0
- package/lang/translations/ja.po +1 -0
- package/lang/translations/ko.po +1 -0
- package/lang/translations/lt.po +1 -0
- package/lang/translations/lv.po +1 -0
- package/lang/translations/ms.po +1 -0
- package/lang/translations/nl.po +1 -0
- package/lang/translations/no.po +1 -0
- package/lang/translations/pl.po +1 -0
- package/lang/translations/pt-br.po +1 -0
- package/lang/translations/pt.po +1 -0
- package/lang/translations/ro.po +1 -0
- package/lang/translations/ru.po +1 -0
- package/lang/translations/sk.po +1 -0
- package/lang/translations/sq.po +1 -0
- package/lang/translations/sr-latn.po +1 -0
- package/lang/translations/sr.po +1 -0
- package/lang/translations/sv.po +1 -0
- package/lang/translations/th.po +1 -0
- package/lang/translations/tk.po +1 -0
- package/lang/translations/tr.po +1 -0
- package/lang/translations/tt.po +1 -0
- package/lang/translations/uk.po +1 -0
- package/lang/translations/ur.po +1 -0
- package/lang/translations/vi.po +1 -0
- package/lang/translations/zh-cn.po +1 -0
- package/lang/translations/zh.po +1 -0
- package/package.json +3 -7
- 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 -0
- package/src/integrations/aiassistant.js +23 -0
- 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 +23 -23
- package/src/integrations/imagereplace.js +1 -1
- 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 +18 -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 +276 -276
- package/src/suggestion.js +1 -1
- package/src/suggestiondescriptionfactory.d.ts +163 -163
- package/src/suggestiondescriptionfactory.js +1 -1
- package/src/trackchanges.d.ts +244 -244
- package/src/trackchanges.js +1 -1
- package/src/trackchangesconfig.d.ts +75 -75
- package/src/trackchangesdata.d.ts +41 -41
- package/src/trackchangesdata.js +1 -1
- package/src/trackchangesediting.d.ts +468 -439
- package/src/trackchangesediting.js +1 -1
- package/src/trackchangesui.d.ts +38 -38
- package/src/trackchangesui.js +1 -1
- package/src/ui/suggestioncontroller.d.ts +37 -37
- package/src/ui/suggestioncontroller.js +1 -1
- package/src/ui/view/basesuggestionthreadview.d.ts +170 -170
- package/src/ui/view/basesuggestionthreadview.js +1 -1
- package/src/ui/view/suggestionthreadview.d.ts +182 -182
- package/src/ui/view/suggestionthreadview.js +1 -1
- package/src/utils/common-translations.d.ts +9 -9
- package/src/utils/common-translations.js +1 -1
- package/src/utils/utils.d.ts +30 -30
- package/src/utils/utils.js +1 -1
- package/theme/icons/track-changes-accept.svg +1 -1
- package/theme/icons/track-changes-discard.svg +1 -1
- package/theme/icons/track-changes.svg +1 -1
|
@@ -1,21 +1,21 @@
|
|
|
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
|
-
import type { Editor } from 'ckeditor5/src/core';
|
|
6
|
-
import type { Range, Model, Element, DowncastAddMarkerEvent } from 'ckeditor5/src/engine';
|
|
7
|
-
import type { GetCallback } from 'ckeditor5/src/utils';
|
|
8
|
-
/**
|
|
9
|
-
* Searches given `range` and returns all sub-ranges containing items with given `attributeKey`.
|
|
10
|
-
*/
|
|
11
|
-
export declare function getRangesWithAttribute(attributeKey: string, range: Range, model: Model): Array<Range>;
|
|
12
|
-
/**
|
|
13
|
-
* For given `element`, if it is a list item, returns all list items that would be affected by renaming `element` to a different element.
|
|
14
|
-
*/
|
|
15
|
-
export declare function getElementsAffectedByListItemRename(element: Element): Array<Element>;
|
|
16
|
-
/**
|
|
17
|
-
* Returns the conversion function for down-casting split/merge markers.
|
|
18
|
-
*/
|
|
19
|
-
export declare function downcastSplitMergeMarker(editor: Editor, type: 'split' | 'merge', { showActiveMarker }?: {
|
|
20
|
-
showActiveMarker?: boolean | undefined;
|
|
21
|
-
}): GetCallback<DowncastAddMarkerEvent>;
|
|
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
|
+
import type { Editor } from 'ckeditor5/src/core';
|
|
6
|
+
import type { Range, Model, Element, DowncastAddMarkerEvent } from 'ckeditor5/src/engine';
|
|
7
|
+
import type { GetCallback } from 'ckeditor5/src/utils';
|
|
8
|
+
/**
|
|
9
|
+
* Searches given `range` and returns all sub-ranges containing items with given `attributeKey`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getRangesWithAttribute(attributeKey: string, range: Range, model: Model): Array<Range>;
|
|
12
|
+
/**
|
|
13
|
+
* For given `element`, if it is a list item, returns all list items that would be affected by renaming `element` to a different element.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getElementsAffectedByListItemRename(element: Element): Array<Element>;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the conversion function for down-casting split/merge markers.
|
|
18
|
+
*/
|
|
19
|
+
export declare function downcastSplitMergeMarker(editor: Editor, type: 'split' | 'merge', { showActiveMarker }?: {
|
|
20
|
+
showActiveMarker?: boolean | undefined;
|
|
21
|
+
}): GetCallback<DowncastAddMarkerEvent>;
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x2987=['name','createRangeOn','get','activeMarkers','markerRange','writer','element','listIndent','push','toViewElement','TrackChangesEditing','createUIElement','type','getItems','listItem','mapper','test','elementEnd','insert','includes','markerName','nextSibling','getCustomProperty','item','addClass','isAtEnd','isContent','getWalker','bindElementToMarker','plugins','model'];(function(_0xba327,_0x2987c7){const _0x5cd508=function(_0x5a57e9){while(--_0x5a57e9){_0xba327['push'](_0xba327['shift']());}};_0x5cd508(++_0x2987c7);}(_0x2987,0x67));const _0x5cd5=function(_0xba327,_0x2987c7){_0xba327=_0xba327-0x0;let _0x5cd508=_0x2987[_0xba327];return _0x5cd508;};export function getRangesWithAttribute(_0x27256a,_0x4ec76e,_0x529c17){const _0x113a58=[];for(const _0xcff14 of _0x4ec76e[_0x5cd5('0x3')]())_0xcff14['hasAttribute'](_0x27256a)&&_0x113a58[_0x5cd5('0x1d')](_0x529c17[_0x5cd5('0x16')](_0xcff14));return _0x113a58;}export function getElementsAffectedByListItemRename(_0x2d6300){const _0x25595d=[];if(_0x2d6300['is'](_0x5cd5('0x1b'),'listItem')){let _0x4ea83b=_0x2d6300[_0x5cd5('0xb')];for(;_0x4ea83b&&_0x4ea83b['is'](_0x5cd5('0x1b'),_0x5cd5('0x4'))&&_0x4ea83b['getAttribute'](_0x5cd5('0x1c'))>0x0;)_0x25595d[_0x5cd5('0x1d')](_0x4ea83b),_0x4ea83b=_0x4ea83b[_0x5cd5('0xb')];}return _0x25595d;}export function downcastSplitMergeMarker(_0x1db6b8,_0x21f513,{showActiveMarker:_0x31c1f8=!0x0}={}){const _0x5205fe=_0x1db6b8[_0x5cd5('0x13')][_0x5cd5('0x17')](_0x5cd5('0x0'));return(_0x5e90ba,_0x107237,_0xb5b61a)=>{if(!_0xb5b61a['consumable'][_0x5cd5('0x6')](_0x107237[_0x5cd5('0x19')],_0x5e90ba[_0x5cd5('0x15')]))return;const _0x93379f=_0x107237['markerRange'][_0x5cd5('0x11')](),_0x5e9a3a=_0x107237['markerRange']['start'],_0x56149f=_0x1db6b8[_0x5cd5('0x14')]['schema'];let _0x4862ba=null,_0x555d22=null,_0x22fd77=!0x1,_0x350f7f=!0x1;for(const _0x2586a8 of _0x93379f){const _0x5929ad=_0x2586a8[_0x5cd5('0xd')];_0x22fd77=_0x22fd77||_0x56149f[_0x5cd5('0x10')](_0x5929ad);const _0x116190=_0xb5b61a[_0x5cd5('0x5')][_0x5cd5('0x1e')](_0x5929ad);if(_0x116190&&_0x116190[_0x5cd5('0xc')]('addHighlight'))return;_0x5cd5('0x7')==_0x2586a8[_0x5cd5('0x2')]&&(_0x56149f['isBlock'](_0x5929ad)&&!_0x56149f['isLimit'](_0x5929ad)&&(_0x5929ad[_0x5cd5('0xb')]||_0x5e9a3a[_0x5cd5('0xf')]?_0x4862ba&&_0x4862ba['parent']==_0x5929ad||(_0x4862ba=_0x5929ad,_0x2a1c57(_0x2586a8['previousPosition']),_0x350f7f=!0x0):_0x555d22=_0x555d22||_0x2586a8['previousPosition']));}function _0x2a1c57(_0x5b2720){const _0x9f1078=_0xb5b61a[_0x5cd5('0x1a')][_0x5cd5('0x1')]('span',{'class':'ck-suggestion-marker-'+_0x21f513}),_0x140632=_0xb5b61a[_0x5cd5('0x5')]['toViewPosition'](_0x5b2720);_0x31c1f8&&_0x5205fe[_0x5cd5('0x18')][_0x5cd5('0x9')](_0x107237[_0x5cd5('0xa')])&&_0xb5b61a[_0x5cd5('0x1a')][_0x5cd5('0xe')]('ck-suggestion-marker--active',_0x9f1078),_0xb5b61a['writer'][_0x5cd5('0x8')](_0x140632,_0x9f1078),_0xb5b61a['mapper'][_0x5cd5('0x12')](_0x9f1078,_0x107237[_0x5cd5('0xa')]);}_0x22fd77||_0x350f7f||!_0x555d22||_0x2a1c57(_0x555d22);};}
|
package/src/suggestion.d.ts
CHANGED
|
@@ -1,276 +1,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 } from './trackchangesediting';
|
|
13
|
-
declare const Suggestion_base: {
|
|
14
|
-
new (): import("ckeditor5/src/utils").Observable;
|
|
15
|
-
prototype: import("ckeditor5/src/utils").Observable; /**
|
|
16
|
-
* Previous suggestion in suggestions chain.
|
|
17
|
-
*
|
|
18
|
-
* Chained suggestions should be handled as one entity.
|
|
19
|
-
*
|
|
20
|
-
* @observable
|
|
21
|
-
*/
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Represents a singular suggestion that is tracked by track changes plugin.
|
|
25
|
-
*
|
|
26
|
-
* `Suggestion` instances are created and handled by {@link module:track-changes/trackchanges~TrackChanges track changes plugin}.
|
|
27
|
-
*/
|
|
28
|
-
export default class Suggestion extends Suggestion_base {
|
|
29
|
-
/**
|
|
30
|
-
* Suggestion ID.
|
|
31
|
-
*/
|
|
32
|
-
readonly id: string;
|
|
33
|
-
/**
|
|
34
|
-
* Suggestion type.
|
|
35
|
-
*/
|
|
36
|
-
type: SuggestionType;
|
|
37
|
-
/**
|
|
38
|
-
* Suggestion sub-type.
|
|
39
|
-
*
|
|
40
|
-
* This is an additional identifier for suggestions. Two suggestions of the same type may have different sub-types to differentiate
|
|
41
|
-
* suggestions behavior and handle interactions between suggestions.
|
|
42
|
-
*
|
|
43
|
-
* Sub-type is used for:
|
|
44
|
-
*
|
|
45
|
-
* * suggestions joining (only suggestions with the same sub-type can be joined),
|
|
46
|
-
* * suggestions custom callbacks (fired when adding, deleting and joining suggestions).
|
|
47
|
-
*/
|
|
48
|
-
subType: string | null;
|
|
49
|
-
/**
|
|
50
|
-
* The author of the change marked by the suggestion.
|
|
51
|
-
*/
|
|
52
|
-
author: User;
|
|
53
|
-
/**
|
|
54
|
-
* The user which saved the suggestion data in the database.
|
|
55
|
-
*
|
|
56
|
-
* Usually the same as author but may be different in some cases (e.g. when suggestion was added from an external source).
|
|
57
|
-
*/
|
|
58
|
-
creator: User;
|
|
59
|
-
/**
|
|
60
|
-
* The flag indicating whether the suggestion comes from an external source.
|
|
61
|
-
*/
|
|
62
|
-
isExternal: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Additional suggestion data.
|
|
65
|
-
*/
|
|
66
|
-
data: FormatData | null;
|
|
67
|
-
/**
|
|
68
|
-
* Date when the suggestion was saved in the database.
|
|
69
|
-
*/
|
|
70
|
-
createdAt: Date | null;
|
|
71
|
-
/**
|
|
72
|
-
* Date when the change marked by the suggestion was made.
|
|
73
|
-
*
|
|
74
|
-
* Usually the same as {@link #createdAt `createdAt`} but may be different in some cases
|
|
75
|
-
* (e.g. when suggestion was added from an external source).
|
|
76
|
-
*
|
|
77
|
-
* @observable
|
|
78
|
-
*/
|
|
79
|
-
authoredAt: Date | null;
|
|
80
|
-
/**
|
|
81
|
-
* Custom suggestion attributes. See also {@link #setAttribute} and {@link #removeAttribute}.
|
|
82
|
-
*
|
|
83
|
-
* @observable
|
|
84
|
-
*/
|
|
85
|
-
attributes: {
|
|
86
|
-
[k: string]: unknown;
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* Previous suggestion in suggestions chain.
|
|
90
|
-
*
|
|
91
|
-
* Chained suggestions should be handled as one entity.
|
|
92
|
-
*
|
|
93
|
-
* @observable
|
|
94
|
-
*/
|
|
95
|
-
previous: Suggestion | null;
|
|
96
|
-
/**
|
|
97
|
-
* Next suggestion in suggestions chain.
|
|
98
|
-
*
|
|
99
|
-
* Chained suggestions should be handled as one entity.
|
|
100
|
-
*
|
|
101
|
-
* @observable
|
|
102
|
-
*/
|
|
103
|
-
next: Suggestion | null;
|
|
104
|
-
/**
|
|
105
|
-
* Comment thread model for comments added to this suggestion.
|
|
106
|
-
*
|
|
107
|
-
* @observable
|
|
108
|
-
*/
|
|
109
|
-
commentThread: CommentThread | null;
|
|
110
|
-
constructor(model: Model, options: SuggestionOptions);
|
|
111
|
-
/**
|
|
112
|
-
* The first (most-previous) suggestion in this suggestion chain.
|
|
113
|
-
*/
|
|
114
|
-
get head(): Suggestion;
|
|
115
|
-
/**
|
|
116
|
-
* Informs whether suggestion has at least one comment.
|
|
117
|
-
*/
|
|
118
|
-
get hasComments(): boolean;
|
|
119
|
-
/**
|
|
120
|
-
* Informs whether the suggestion is a multi-range suggestion or a single-range suggestion.
|
|
121
|
-
*
|
|
122
|
-
* This is evaluated basing on the marker name belonging to this suggestion.
|
|
123
|
-
* Even if only one marker belongs to the suggestion at a given time it can still be a multi range suggestion.
|
|
124
|
-
*/
|
|
125
|
-
get isMultiRange(): boolean;
|
|
126
|
-
/**
|
|
127
|
-
* Informs whether the suggestion is still in the editor content.
|
|
128
|
-
*
|
|
129
|
-
* Returns `true` if there is at least one marker suggestion in the editor content.
|
|
130
|
-
*/
|
|
131
|
-
get isInContent(): boolean;
|
|
132
|
-
/**
|
|
133
|
-
* Binds given marker name to this suggestion.
|
|
134
|
-
*/
|
|
135
|
-
addMarkerName(markerName: string): void;
|
|
136
|
-
/**
|
|
137
|
-
* Returns all names of markers belonging to this suggestion.
|
|
138
|
-
*/
|
|
139
|
-
getMarkerNames(): Array<string>;
|
|
140
|
-
/**
|
|
141
|
-
* Returns all markers belonging to this suggestion.
|
|
142
|
-
*/
|
|
143
|
-
getMarkers(): Array<Marker>;
|
|
144
|
-
/**
|
|
145
|
-
* Returns the first marker belonging to this suggestion, i.e the first marker that was added to this suggestion
|
|
146
|
-
* and not removed yet.
|
|
147
|
-
*
|
|
148
|
-
* This method is useful if you know that the suggestion has only one marker and want to process it.
|
|
149
|
-
*/
|
|
150
|
-
getFirstMarker(): Marker | null;
|
|
151
|
-
/**
|
|
152
|
-
* Removes all markers from the suggestion and the editor content.
|
|
153
|
-
*/
|
|
154
|
-
removeMarkers(): void;
|
|
155
|
-
/**
|
|
156
|
-
* Removes marker with the given name from the suggestion and the editor content.
|
|
157
|
-
*/
|
|
158
|
-
removeMarker(markerName: string): void;
|
|
159
|
-
/**
|
|
160
|
-
* Adds a new range to this suggestion. It is assumed that the suggestion is a multi-range suggestion.
|
|
161
|
-
*
|
|
162
|
-
* A marker name is generated from this suggestion's properties and a marker with that name is created and set to a given `range`.
|
|
163
|
-
*/
|
|
164
|
-
addRange(range: Range): void;
|
|
165
|
-
/**
|
|
166
|
-
* Checks if given `range` is intersecting with any of the ranges of markers belonging to this suggestion.
|
|
167
|
-
*/
|
|
168
|
-
isIntersectingWithRange(range: Range): boolean;
|
|
169
|
-
/**
|
|
170
|
-
* Returns all ranges of all markers belonging to this suggestion.
|
|
171
|
-
*/
|
|
172
|
-
getRanges(): Array<Range>;
|
|
173
|
-
/**
|
|
174
|
-
* Returns all {@link module:engine/model/item~Item model items} that are in this suggestion.
|
|
175
|
-
*/
|
|
176
|
-
getItems(): Array<Item>;
|
|
177
|
-
/**
|
|
178
|
-
* Returns the first range belonging to this suggestion, i.e. the range of the first marker that was added to
|
|
179
|
-
* this suggestion and not removed yet.
|
|
180
|
-
*
|
|
181
|
-
* This method is useful if you know that the suggestion has only one marker and want to process its range.
|
|
182
|
-
*/
|
|
183
|
-
getFirstRange(): Range | null;
|
|
184
|
-
/**
|
|
185
|
-
* Returns the model element contained in the suggestion.
|
|
186
|
-
*
|
|
187
|
-
* A {@link module:engine/model/element~Element model element} is considered as contained if there is exactly
|
|
188
|
-
* one range in the suggestion, and that range contains exactly one element.
|
|
189
|
-
*
|
|
190
|
-
* Returns `null` if there is no contained element.
|
|
191
|
-
*/
|
|
192
|
-
getContainedElement(): Element | null;
|
|
193
|
-
/**
|
|
194
|
-
* Accepts the suggestion.
|
|
195
|
-
*/
|
|
196
|
-
accept(): void;
|
|
197
|
-
/**
|
|
198
|
-
* Discards the suggestion.
|
|
199
|
-
*/
|
|
200
|
-
discard(): void;
|
|
201
|
-
/**
|
|
202
|
-
* Returns all suggestions that are in this suggestion chain.
|
|
203
|
-
*/
|
|
204
|
-
getAllAdjacentSuggestions(): Array<Suggestion>;
|
|
205
|
-
/**
|
|
206
|
-
* Adds suggestion attribute.
|
|
207
|
-
*
|
|
208
|
-
* Suggestion attributes are custom data that can be set and used by features
|
|
209
|
-
* built around suggestions. Use it to store your feature data with other suggestion data.
|
|
210
|
-
*
|
|
211
|
-
* ```ts
|
|
212
|
-
* suggestion.setAttribute( 'isImportant', true );
|
|
213
|
-
* ```
|
|
214
|
-
*
|
|
215
|
-
* You can group multiple values in an object, using dot notation:
|
|
216
|
-
*
|
|
217
|
-
* ```ts
|
|
218
|
-
* suggestion.setAttribute( 'customData.type', 'image' );
|
|
219
|
-
* suggestion.setAttribute( 'customData.src', 'foo.jpg' );
|
|
220
|
-
* ```
|
|
221
|
-
*
|
|
222
|
-
* Attributes set on the suggestion can be accessed through `attribute` property:
|
|
223
|
-
*
|
|
224
|
-
* ```ts
|
|
225
|
-
* const isImportant = suggestion.attributes.isImportant;
|
|
226
|
-
* const type = suggestion.attributes.customData.type;
|
|
227
|
-
* ```
|
|
228
|
-
*
|
|
229
|
-
* You can also observe `attributes` property or bind other properties to it:
|
|
230
|
-
*
|
|
231
|
-
* ```ts
|
|
232
|
-
* myObj.bind( 'customData' ).to( suggestion, 'attributes', attributes => attributes.customData );
|
|
233
|
-
* ```
|
|
234
|
-
*
|
|
235
|
-
* Whenever `setAttribute()` or `removeAttribute()` is called, `attributes` property
|
|
236
|
-
* is re-set and observables are refreshed.
|
|
237
|
-
*/
|
|
238
|
-
setAttribute(name: string, value: unknown): void;
|
|
239
|
-
/**
|
|
240
|
-
* Removes suggestion attribute.
|
|
241
|
-
*
|
|
242
|
-
* See also {@link #setAttribute}
|
|
243
|
-
*/
|
|
244
|
-
removeAttribute(name: string): void;
|
|
245
|
-
toJSON(): SuggestionJSON;
|
|
246
|
-
/**
|
|
247
|
-
* Returns a random string that can be used as additional identifier for the marker name for suggestions that are multi range.
|
|
248
|
-
*/
|
|
249
|
-
static getMultiRangeId(): string;
|
|
250
|
-
}
|
|
251
|
-
export interface SuggestionOptions {
|
|
252
|
-
id: string;
|
|
253
|
-
type: SuggestionType;
|
|
254
|
-
subType: string | null;
|
|
255
|
-
attributes: {
|
|
256
|
-
[k: string]: unknown;
|
|
257
|
-
};
|
|
258
|
-
author: User;
|
|
259
|
-
creator: User;
|
|
260
|
-
onAccept: Function;
|
|
261
|
-
onDiscard: Function;
|
|
262
|
-
onAttributesChange: Function;
|
|
263
|
-
}
|
|
264
|
-
export interface SuggestionJSON {
|
|
265
|
-
id: string;
|
|
266
|
-
type: string;
|
|
267
|
-
authorId: string;
|
|
268
|
-
createdAt: Date | null;
|
|
269
|
-
hasComments?: boolean;
|
|
270
|
-
data?: FormatData | null;
|
|
271
|
-
attributes: {
|
|
272
|
-
[k: string]: unknown;
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
export type SuggestionType = 'insertion' | 'deletion' | 'formatInline' | 'formatBlock';
|
|
276
|
-
export {};
|
|
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
|
+
* Previous suggestion in suggestions chain.
|
|
17
|
+
*
|
|
18
|
+
* Chained suggestions should be handled as one entity.
|
|
19
|
+
*
|
|
20
|
+
* @observable
|
|
21
|
+
*/
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Represents a singular suggestion that is tracked by track changes plugin.
|
|
25
|
+
*
|
|
26
|
+
* `Suggestion` instances are created and handled by {@link module:track-changes/trackchanges~TrackChanges track changes plugin}.
|
|
27
|
+
*/
|
|
28
|
+
export default class Suggestion extends Suggestion_base {
|
|
29
|
+
/**
|
|
30
|
+
* Suggestion ID.
|
|
31
|
+
*/
|
|
32
|
+
readonly id: string;
|
|
33
|
+
/**
|
|
34
|
+
* Suggestion type.
|
|
35
|
+
*/
|
|
36
|
+
type: SuggestionType;
|
|
37
|
+
/**
|
|
38
|
+
* Suggestion sub-type.
|
|
39
|
+
*
|
|
40
|
+
* This is an additional identifier for suggestions. Two suggestions of the same type may have different sub-types to differentiate
|
|
41
|
+
* suggestions behavior and handle interactions between suggestions.
|
|
42
|
+
*
|
|
43
|
+
* Sub-type is used for:
|
|
44
|
+
*
|
|
45
|
+
* * suggestions joining (only suggestions with the same sub-type can be joined),
|
|
46
|
+
* * suggestions custom callbacks (fired when adding, deleting and joining suggestions).
|
|
47
|
+
*/
|
|
48
|
+
subType: string | null;
|
|
49
|
+
/**
|
|
50
|
+
* The author of the change marked by the suggestion.
|
|
51
|
+
*/
|
|
52
|
+
author: User;
|
|
53
|
+
/**
|
|
54
|
+
* The user which saved the suggestion data in the database.
|
|
55
|
+
*
|
|
56
|
+
* Usually the same as author but may be different in some cases (e.g. when suggestion was added from an external source).
|
|
57
|
+
*/
|
|
58
|
+
creator: User;
|
|
59
|
+
/**
|
|
60
|
+
* The flag indicating whether the suggestion comes from an external source.
|
|
61
|
+
*/
|
|
62
|
+
isExternal: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Additional suggestion data.
|
|
65
|
+
*/
|
|
66
|
+
data: FormatData | null;
|
|
67
|
+
/**
|
|
68
|
+
* Date when the suggestion was saved in the database.
|
|
69
|
+
*/
|
|
70
|
+
createdAt: Date | null;
|
|
71
|
+
/**
|
|
72
|
+
* Date when the change marked by the suggestion was made.
|
|
73
|
+
*
|
|
74
|
+
* Usually the same as {@link #createdAt `createdAt`} but may be different in some cases
|
|
75
|
+
* (e.g. when suggestion was added from an external source).
|
|
76
|
+
*
|
|
77
|
+
* @observable
|
|
78
|
+
*/
|
|
79
|
+
authoredAt: Date | null;
|
|
80
|
+
/**
|
|
81
|
+
* Custom suggestion attributes. See also {@link #setAttribute} and {@link #removeAttribute}.
|
|
82
|
+
*
|
|
83
|
+
* @observable
|
|
84
|
+
*/
|
|
85
|
+
attributes: {
|
|
86
|
+
[k: string]: unknown;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Previous suggestion in suggestions chain.
|
|
90
|
+
*
|
|
91
|
+
* Chained suggestions should be handled as one entity.
|
|
92
|
+
*
|
|
93
|
+
* @observable
|
|
94
|
+
*/
|
|
95
|
+
previous: Suggestion | null;
|
|
96
|
+
/**
|
|
97
|
+
* Next suggestion in suggestions chain.
|
|
98
|
+
*
|
|
99
|
+
* Chained suggestions should be handled as one entity.
|
|
100
|
+
*
|
|
101
|
+
* @observable
|
|
102
|
+
*/
|
|
103
|
+
next: Suggestion | null;
|
|
104
|
+
/**
|
|
105
|
+
* Comment thread model for comments added to this suggestion.
|
|
106
|
+
*
|
|
107
|
+
* @observable
|
|
108
|
+
*/
|
|
109
|
+
commentThread: CommentThread | null;
|
|
110
|
+
constructor(model: Model, options: SuggestionOptions);
|
|
111
|
+
/**
|
|
112
|
+
* The first (most-previous) suggestion in this suggestion chain.
|
|
113
|
+
*/
|
|
114
|
+
get head(): Suggestion;
|
|
115
|
+
/**
|
|
116
|
+
* Informs whether suggestion has at least one comment.
|
|
117
|
+
*/
|
|
118
|
+
get hasComments(): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Informs whether the suggestion is a multi-range suggestion or a single-range suggestion.
|
|
121
|
+
*
|
|
122
|
+
* This is evaluated basing on the marker name belonging to this suggestion.
|
|
123
|
+
* Even if only one marker belongs to the suggestion at a given time it can still be a multi range suggestion.
|
|
124
|
+
*/
|
|
125
|
+
get isMultiRange(): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Informs whether the suggestion is still in the editor content.
|
|
128
|
+
*
|
|
129
|
+
* Returns `true` if there is at least one marker suggestion in the editor content.
|
|
130
|
+
*/
|
|
131
|
+
get isInContent(): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Binds given marker name to this suggestion.
|
|
134
|
+
*/
|
|
135
|
+
addMarkerName(markerName: string): void;
|
|
136
|
+
/**
|
|
137
|
+
* Returns all names of markers belonging to this suggestion.
|
|
138
|
+
*/
|
|
139
|
+
getMarkerNames(): Array<string>;
|
|
140
|
+
/**
|
|
141
|
+
* Returns all markers belonging to this suggestion.
|
|
142
|
+
*/
|
|
143
|
+
getMarkers(): Array<Marker>;
|
|
144
|
+
/**
|
|
145
|
+
* Returns the first marker belonging to this suggestion, i.e the first marker that was added to this suggestion
|
|
146
|
+
* and not removed yet.
|
|
147
|
+
*
|
|
148
|
+
* This method is useful if you know that the suggestion has only one marker and want to process it.
|
|
149
|
+
*/
|
|
150
|
+
getFirstMarker(): Marker | null;
|
|
151
|
+
/**
|
|
152
|
+
* Removes all markers from the suggestion and the editor content.
|
|
153
|
+
*/
|
|
154
|
+
removeMarkers(): void;
|
|
155
|
+
/**
|
|
156
|
+
* Removes marker with the given name from the suggestion and the editor content.
|
|
157
|
+
*/
|
|
158
|
+
removeMarker(markerName: string): void;
|
|
159
|
+
/**
|
|
160
|
+
* Adds a new range to this suggestion. It is assumed that the suggestion is a multi-range suggestion.
|
|
161
|
+
*
|
|
162
|
+
* A marker name is generated from this suggestion's properties and a marker with that name is created and set to a given `range`.
|
|
163
|
+
*/
|
|
164
|
+
addRange(range: Range): void;
|
|
165
|
+
/**
|
|
166
|
+
* Checks if given `range` is intersecting with any of the ranges of markers belonging to this suggestion.
|
|
167
|
+
*/
|
|
168
|
+
isIntersectingWithRange(range: Range): boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Returns all ranges of all markers belonging to this suggestion.
|
|
171
|
+
*/
|
|
172
|
+
getRanges(): Array<Range>;
|
|
173
|
+
/**
|
|
174
|
+
* Returns all {@link module:engine/model/item~Item model items} that are in this suggestion.
|
|
175
|
+
*/
|
|
176
|
+
getItems(): Array<Item>;
|
|
177
|
+
/**
|
|
178
|
+
* Returns the first range belonging to this suggestion, i.e. the range of the first marker that was added to
|
|
179
|
+
* this suggestion and not removed yet.
|
|
180
|
+
*
|
|
181
|
+
* This method is useful if you know that the suggestion has only one marker and want to process its range.
|
|
182
|
+
*/
|
|
183
|
+
getFirstRange(): Range | null;
|
|
184
|
+
/**
|
|
185
|
+
* Returns the model element contained in the suggestion.
|
|
186
|
+
*
|
|
187
|
+
* A {@link module:engine/model/element~Element model element} is considered as contained if there is exactly
|
|
188
|
+
* one range in the suggestion, and that range contains exactly one element.
|
|
189
|
+
*
|
|
190
|
+
* Returns `null` if there is no contained element.
|
|
191
|
+
*/
|
|
192
|
+
getContainedElement(): Element | null;
|
|
193
|
+
/**
|
|
194
|
+
* Accepts the suggestion.
|
|
195
|
+
*/
|
|
196
|
+
accept(): void;
|
|
197
|
+
/**
|
|
198
|
+
* Discards the suggestion.
|
|
199
|
+
*/
|
|
200
|
+
discard(): void;
|
|
201
|
+
/**
|
|
202
|
+
* Returns all suggestions that are in this suggestion chain.
|
|
203
|
+
*/
|
|
204
|
+
getAllAdjacentSuggestions(): Array<Suggestion>;
|
|
205
|
+
/**
|
|
206
|
+
* Adds suggestion attribute.
|
|
207
|
+
*
|
|
208
|
+
* Suggestion attributes are custom data that can be set and used by features
|
|
209
|
+
* built around suggestions. Use it to store your feature data with other suggestion data.
|
|
210
|
+
*
|
|
211
|
+
* ```ts
|
|
212
|
+
* suggestion.setAttribute( 'isImportant', true );
|
|
213
|
+
* ```
|
|
214
|
+
*
|
|
215
|
+
* You can group multiple values in an object, using dot notation:
|
|
216
|
+
*
|
|
217
|
+
* ```ts
|
|
218
|
+
* suggestion.setAttribute( 'customData.type', 'image' );
|
|
219
|
+
* suggestion.setAttribute( 'customData.src', 'foo.jpg' );
|
|
220
|
+
* ```
|
|
221
|
+
*
|
|
222
|
+
* Attributes set on the suggestion can be accessed through `attribute` property:
|
|
223
|
+
*
|
|
224
|
+
* ```ts
|
|
225
|
+
* const isImportant = suggestion.attributes.isImportant;
|
|
226
|
+
* const type = suggestion.attributes.customData.type;
|
|
227
|
+
* ```
|
|
228
|
+
*
|
|
229
|
+
* You can also observe `attributes` property or bind other properties to it:
|
|
230
|
+
*
|
|
231
|
+
* ```ts
|
|
232
|
+
* myObj.bind( 'customData' ).to( suggestion, 'attributes', attributes => attributes.customData );
|
|
233
|
+
* ```
|
|
234
|
+
*
|
|
235
|
+
* Whenever `setAttribute()` or `removeAttribute()` is called, `attributes` property
|
|
236
|
+
* is re-set and observables are refreshed.
|
|
237
|
+
*/
|
|
238
|
+
setAttribute(name: string, value: unknown): void;
|
|
239
|
+
/**
|
|
240
|
+
* Removes suggestion attribute.
|
|
241
|
+
*
|
|
242
|
+
* See also {@link #setAttribute}
|
|
243
|
+
*/
|
|
244
|
+
removeAttribute(name: string): void;
|
|
245
|
+
toJSON(): SuggestionJSON;
|
|
246
|
+
/**
|
|
247
|
+
* Returns a random string that can be used as additional identifier for the marker name for suggestions that are multi range.
|
|
248
|
+
*/
|
|
249
|
+
static getMultiRangeId(): string;
|
|
250
|
+
}
|
|
251
|
+
export interface SuggestionOptions {
|
|
252
|
+
id: string;
|
|
253
|
+
type: SuggestionType;
|
|
254
|
+
subType: string | null;
|
|
255
|
+
attributes: {
|
|
256
|
+
[k: string]: unknown;
|
|
257
|
+
};
|
|
258
|
+
author: User;
|
|
259
|
+
creator: User;
|
|
260
|
+
onAccept: Function;
|
|
261
|
+
onDiscard: Function;
|
|
262
|
+
onAttributesChange: Function;
|
|
263
|
+
}
|
|
264
|
+
export interface SuggestionJSON {
|
|
265
|
+
id: string;
|
|
266
|
+
type: string;
|
|
267
|
+
authorId: string;
|
|
268
|
+
createdAt: Date | null;
|
|
269
|
+
hasComments?: boolean;
|
|
270
|
+
data?: FormatData | null;
|
|
271
|
+
attributes: {
|
|
272
|
+
[k: string]: unknown;
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
export type SuggestionType = 'insertion' | 'deletion' | 'formatInline' | 'formatBlock';
|
|
276
|
+
export {};
|