@ckeditor/ckeditor5-track-changes 38.1.1 → 38.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/track-changes.js +2 -2
- package/package.json +4 -3
- package/src/augmentation.d.ts +36 -36
- package/src/commands/acceptsuggestioncommand.d.ts +20 -20
- package/src/commands/acceptsuggestioncommand.js +1 -1
- package/src/commands/discardsuggestioncommand.d.ts +20 -20
- package/src/commands/discardsuggestioncommand.js +1 -1
- package/src/commands/executeonallsuggestionscommand.d.ts +20 -20
- package/src/commands/executeonallsuggestionscommand.js +1 -1
- package/src/commands/executeonselectedsuggestionscommand.d.ts +20 -20
- package/src/commands/executeonselectedsuggestionscommand.js +1 -1
- package/src/commands/trackchangescommand.d.ts +22 -22
- package/src/commands/trackchangescommand.js +1 -1
- package/src/index.d.ts +12 -12
- package/src/index.js +1 -1
- package/src/integrations/alignment.d.ts +13 -13
- package/src/integrations/alignment.js +1 -1
- package/src/integrations/basicstyles.d.ts +13 -13
- package/src/integrations/basicstyles.js +1 -1
- package/src/integrations/blockquote.d.ts +13 -13
- package/src/integrations/blockquote.js +1 -1
- package/src/integrations/ckbox.d.ts +13 -13
- package/src/integrations/ckbox.js +1 -1
- package/src/integrations/codeblock.d.ts +13 -13
- package/src/integrations/codeblock.js +1 -1
- package/src/integrations/comments.d.ts +10 -10
- package/src/integrations/comments.js +1 -1
- package/src/integrations/deletecommand.d.ts +13 -13
- package/src/integrations/deletecommand.js +1 -1
- package/src/integrations/documentlist.d.ts +13 -13
- package/src/integrations/documentlist.js +1 -1
- package/src/integrations/documentlistproperties.d.ts +25 -25
- package/src/integrations/documentlistproperties.js +1 -1
- package/src/integrations/entercommand.d.ts +12 -12
- package/src/integrations/entercommand.js +1 -1
- package/src/integrations/findandreplace.d.ts +17 -17
- package/src/integrations/findandreplace.js +1 -1
- package/src/integrations/font.d.ts +13 -13
- package/src/integrations/font.js +1 -1
- package/src/integrations/formatpainter.d.ts +13 -13
- package/src/integrations/formatpainter.js +1 -1
- package/src/integrations/heading.d.ts +13 -13
- package/src/integrations/heading.js +1 -1
- package/src/integrations/highlight.d.ts +13 -13
- package/src/integrations/highlight.js +1 -1
- package/src/integrations/horizontalline.d.ts +13 -13
- package/src/integrations/horizontalline.js +1 -1
- package/src/integrations/htmlembed.d.ts +13 -13
- package/src/integrations/htmlembed.js +1 -1
- package/src/integrations/image.d.ts +13 -13
- package/src/integrations/image.js +1 -1
- package/src/integrations/imagereplace.d.ts +19 -19
- package/src/integrations/imagereplace.js +1 -1
- package/src/integrations/importword.d.ts +14 -14
- package/src/integrations/importword.js +1 -1
- package/src/integrations/indent.d.ts +13 -13
- package/src/integrations/indent.js +1 -1
- package/src/integrations/inputcommand.d.ts +12 -12
- package/src/integrations/inputcommand.js +1 -1
- package/src/integrations/link.d.ts +13 -13
- package/src/integrations/link.js +1 -1
- package/src/integrations/list.d.ts +13 -13
- package/src/integrations/list.js +1 -1
- package/src/integrations/listproperties.d.ts +25 -25
- package/src/integrations/listproperties.js +1 -1
- package/src/integrations/mediaembed.d.ts +13 -13
- package/src/integrations/mediaembed.js +1 -1
- package/src/integrations/mention.d.ts +13 -13
- package/src/integrations/mention.js +1 -1
- package/src/integrations/pagebreak.d.ts +13 -13
- package/src/integrations/pagebreak.js +1 -1
- package/src/integrations/paragraph.d.ts +13 -13
- package/src/integrations/paragraph.js +1 -1
- package/src/integrations/removeformat.d.ts +13 -13
- package/src/integrations/removeformat.js +1 -1
- package/src/integrations/restrictededitingmode.d.ts +13 -13
- package/src/integrations/restrictededitingmode.js +1 -1
- package/src/integrations/shiftentercommand.d.ts +12 -12
- package/src/integrations/shiftentercommand.js +1 -1
- package/src/integrations/standardeditingmode.d.ts +13 -13
- package/src/integrations/standardeditingmode.js +1 -1
- package/src/integrations/style.d.ts +14 -14
- package/src/integrations/style.js +1 -1
- package/src/integrations/table.d.ts +38 -38
- package/src/integrations/table.js +1 -1
- package/src/integrations/tablecaption.d.ts +18 -18
- package/src/integrations/tablecaption.js +1 -1
- package/src/integrations/tableclipboard.d.ts +18 -18
- package/src/integrations/tableclipboard.js +1 -1
- package/src/integrations/tablecolumnresize.d.ts +22 -22
- package/src/integrations/tablecolumnresize.js +1 -1
- package/src/integrations/tableheadings.d.ts +18 -18
- package/src/integrations/tableheadings.js +1 -1
- package/src/integrations/tablemergesplit.d.ts +18 -18
- package/src/integrations/tablemergesplit.js +1 -1
- package/src/integrations/tableofcontents.d.ts +13 -13
- package/src/integrations/tableofcontents.js +1 -1
- package/src/integrations/tableproperties.d.ts +23 -23
- package/src/integrations/tableproperties.js +1 -1
- package/src/integrations/template.d.ts +13 -13
- package/src/integrations/template.js +1 -1
- package/src/integrations/title.d.ts +13 -13
- package/src/integrations/title.js +1 -1
- package/src/integrations/undo.d.ts +13 -13
- package/src/integrations/undo.js +1 -1
- package/src/integrations/utils.d.ts +17 -17
- package/src/integrations/utils.js +1 -1
- package/src/suggestion.d.ts +266 -266
- package/src/suggestion.js +1 -1
- package/src/suggestiondescriptionfactory.d.ts +163 -151
- package/src/suggestiondescriptionfactory.js +1 -1
- package/src/trackchanges.d.ts +240 -240
- package/src/trackchanges.js +1 -1
- package/src/trackchangesconfig.d.ts +71 -71
- package/src/trackchangesdata.d.ts +37 -37
- package/src/trackchangesdata.js +1 -1
- package/src/trackchangesediting.d.ts +435 -435
- package/src/trackchangesediting.js +1 -1
- package/src/trackchangesui.d.ts +34 -34
- package/src/trackchangesui.js +1 -1
- package/src/ui/suggestioncontroller.d.ts +36 -36
- package/src/ui/suggestioncontroller.js +1 -1
- package/src/ui/view/basesuggestionthreadview.d.ts +166 -166
- 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 +5 -5
- package/src/utils/common-translations.js +1 -1
- package/src/utils/utils.d.ts +26 -26
- package/src/utils/utils.js +1 -1
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module track-changes/ui/suggestioncontroller
|
|
3
|
-
*/
|
|
4
|
-
import type { Editor } from 'ckeditor5/src/core';
|
|
5
|
-
import type Suggestion from '../suggestion';
|
|
6
|
-
import type BaseSuggestionThreadView from './view/basesuggestionthreadview';
|
|
7
|
-
import type { CommentThreadController } from '@ckeditor/ckeditor5-comments';
|
|
8
|
-
declare const SuggestionController_base: {
|
|
9
|
-
new (): import("ckeditor5/src/utils").Observable;
|
|
10
|
-
prototype: import("ckeditor5/src/utils").Observable;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* A controller for a suggestion.
|
|
14
|
-
*
|
|
15
|
-
* It takes a suggestion thread view, listens to events fired by that view and based on them performs actions
|
|
16
|
-
* on the provided suggestion model.
|
|
17
|
-
*/
|
|
18
|
-
export default class SuggestionController extends SuggestionController_base {
|
|
19
|
-
model: Suggestion;
|
|
20
|
-
view: BaseSuggestionThreadView;
|
|
21
|
-
commentThreadController: CommentThreadController;
|
|
22
|
-
constructor(editor: Editor, model: Suggestion, view: BaseSuggestionThreadView, commentThreadController: CommentThreadController);
|
|
23
|
-
/**
|
|
24
|
-
* Accepts the suggestion that belongs to this controller.
|
|
25
|
-
*/
|
|
26
|
-
acceptSuggestion(): void;
|
|
27
|
-
/**
|
|
28
|
-
* Discards the suggestion that belongs to this controller.
|
|
29
|
-
*/
|
|
30
|
-
discardSuggestion(): void;
|
|
31
|
-
/**
|
|
32
|
-
* Destroys `SuggestionController` instance.
|
|
33
|
-
*/
|
|
34
|
-
destroy(): void;
|
|
35
|
-
}
|
|
36
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* @module track-changes/ui/suggestioncontroller
|
|
3
|
+
*/
|
|
4
|
+
import type { Editor } from 'ckeditor5/src/core.js';
|
|
5
|
+
import type Suggestion from '../suggestion.js';
|
|
6
|
+
import type BaseSuggestionThreadView from './view/basesuggestionthreadview.js';
|
|
7
|
+
import type { CommentThreadController } from '@ckeditor/ckeditor5-comments';
|
|
8
|
+
declare const SuggestionController_base: {
|
|
9
|
+
new (): import("ckeditor5/src/utils.js").Observable;
|
|
10
|
+
prototype: import("ckeditor5/src/utils.js").Observable;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A controller for a suggestion.
|
|
14
|
+
*
|
|
15
|
+
* It takes a suggestion thread view, listens to events fired by that view and based on them performs actions
|
|
16
|
+
* on the provided suggestion model.
|
|
17
|
+
*/
|
|
18
|
+
export default class SuggestionController extends SuggestionController_base {
|
|
19
|
+
model: Suggestion;
|
|
20
|
+
view: BaseSuggestionThreadView;
|
|
21
|
+
commentThreadController: CommentThreadController;
|
|
22
|
+
constructor(editor: Editor, model: Suggestion, view: BaseSuggestionThreadView, commentThreadController: CommentThreadController);
|
|
23
|
+
/**
|
|
24
|
+
* Accepts the suggestion that belongs to this controller.
|
|
25
|
+
*/
|
|
26
|
+
acceptSuggestion(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Discards the suggestion that belongs to this controller.
|
|
29
|
+
*/
|
|
30
|
+
discardSuggestion(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Destroys `SuggestionController` instance.
|
|
33
|
+
*/
|
|
34
|
+
destroy(): void;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x5087=['commands','isEnabled','discardSuggestion','_editor','getRanges','change:isDirty','_acceptCommand','_pendingAction','_setPendingAction','execute','bind','canEditAt','PendingActions','model','add','plugins','_removePendingAction','isDirty','unbind','locale','_discardCommand','stopListening','commentThreadController','view','get','listenTo','acceptSuggestion'];(function(_0x9051b4,_0x50879a){const _0x45cb16=function(_0x3104ff){while(--_0x3104ff){_0x9051b4['push'](_0x9051b4['shift']());}};_0x45cb16(++_0x50879a);}(_0x5087,0x89));const _0x45cb=function(_0x9051b4,_0x50879a){_0x9051b4=_0x9051b4-0x0;let _0x45cb16=_0x5087[_0x9051b4];return _0x45cb16;};import{ObservableMixin as _0x50ad59}from'ckeditor5/src/utils.js';import{getTranslation as _0x4aff89}from'../utils/common-translations.js';export default class Ot extends _0x50ad59(){constructor(_0x51e502,_0x50a307,_0x367c6f,_0x54ce63){super(),this['model']=_0x50a307,this['view']=_0x367c6f,this[_0x45cb('0x14')]=_0x54ce63,this[_0x45cb('0x1')]=_0x51e502,this[_0x45cb('0x4')]=_0x51e502[_0x45cb('0x19')][_0x45cb('0x16')]('acceptSuggestion'),this[_0x45cb('0x12')]=_0x51e502[_0x45cb('0x19')][_0x45cb('0x16')](_0x45cb('0x0')),this[_0x45cb('0x15')][_0x45cb('0x8')](_0x45cb('0x1a'))['to'](this[_0x45cb('0x4')],this[_0x45cb('0x12')],(_0x15949b,_0x1cb23c)=>_0x15949b||_0x1cb23c),this[_0x45cb('0x15')][_0x45cb('0x8')]('canAccept')['to'](this[_0x45cb('0x4')],_0x45cb('0x1a'),_0xc6242b=>_0xc6242b&&this[_0x45cb('0x1')][_0x45cb('0xb')][_0x45cb('0x9')](_0x50a307[_0x45cb('0x2')]())),this[_0x45cb('0x15')][_0x45cb('0x8')]('canDiscard')['to'](this[_0x45cb('0x12')],_0x45cb('0x1a'),_0x4042ce=>_0x4042ce&&this[_0x45cb('0x1')][_0x45cb('0xb')][_0x45cb('0x9')](_0x50a307[_0x45cb('0x2')]())),this[_0x45cb('0x5')]=null,_0x367c6f[_0x45cb('0xf')]&&this[_0x45cb('0x6')](),this['listenTo'](_0x367c6f,_0x45cb('0x18'),()=>this[_0x45cb('0x18')]()),this[_0x45cb('0x17')](_0x367c6f,_0x45cb('0x0'),()=>this['discardSuggestion']()),this[_0x45cb('0x17')](_0x367c6f,_0x45cb('0x3'),()=>{_0x367c6f[_0x45cb('0xf')]?this[_0x45cb('0x6')]():this[_0x45cb('0xe')]();});}[_0x45cb('0x18')](){this[_0x45cb('0x4')]['execute'](this['model']['id']);}[_0x45cb('0x0')](){this[_0x45cb('0x12')][_0x45cb('0x7')](this[_0x45cb('0xb')]['id']);}['destroy'](){this[_0x45cb('0x15')][_0x45cb('0x10')](_0x45cb('0x1a')),this[_0x45cb('0x15')][_0x45cb('0x10')]('canAccept'),this[_0x45cb('0x15')][_0x45cb('0x10')]('canDiscard'),this[_0x45cb('0x13')](),this['commentThreadController']['destroy'](),this['_pendingAction']&&this[_0x45cb('0xe')]();}[_0x45cb('0x6')](){const _0x5c6b5d=_0x4aff89(this[_0x45cb('0x1')][_0x45cb('0x11')],'PENDING_ACTION_SUGGESTION');this[_0x45cb('0x5')]=this[_0x45cb('0x1')][_0x45cb('0xd')][_0x45cb('0x16')](_0x45cb('0xa'))[_0x45cb('0xc')](_0x5c6b5d);}[_0x45cb('0xe')](){null!==this[_0x45cb('0x5')]&&this['_editor']['plugins'][_0x45cb('0x16')]('PendingActions')['remove'](this[_0x45cb('0x5')]),this[_0x45cb('0x5')]=null;}}
|
|
@@ -1,166 +1,166 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module track-changes/ui/view/basesuggestionthreadview
|
|
3
|
-
* @publicApi
|
|
4
|
-
*/
|
|
5
|
-
import { View } from 'ckeditor5/src/ui';
|
|
6
|
-
import type { Locale } from 'ckeditor5/src/utils';
|
|
7
|
-
import type { EditorConfig } from 'ckeditor5/src/core';
|
|
8
|
-
import type Suggestion from '../../suggestion';
|
|
9
|
-
import type { CommentsListView, CommentThreadInputView, CommentView } from '@ckeditor/ckeditor5-comments';
|
|
10
|
-
import type { User } from 'ckeditor5-collaboration
|
|
11
|
-
import type { Description } from '../../suggestiondescriptionfactory';
|
|
12
|
-
/**
|
|
13
|
-
* An abstract suggestion thread view class that should be used as a base for suggestion thread view implementations.
|
|
14
|
-
* It provides some behaviors, flags and building blocks to use when creating a custom suggestion thread view class.
|
|
15
|
-
*
|
|
16
|
-
* All events fired by {@link module:comments/comments/ui/view/basecommentview~BaseCommentView}
|
|
17
|
-
* are delegated to {@link module:track-changes/ui/view/basesuggestionthreadview~BaseSuggestionThreadView}.
|
|
18
|
-
* This means that {@link module:track-changes/ui/view/basesuggestionthreadview~BaseSuggestionThreadView} can also fire these
|
|
19
|
-
* events to communicate with CKEditor 5 collaboration features.
|
|
20
|
-
*
|
|
21
|
-
* For the usage examples check the {@glink features/collaboration/annotations/annotations-custom-view
|
|
22
|
-
* Annotations custom view} guide.
|
|
23
|
-
*/
|
|
24
|
-
export default abstract class BaseSuggestionThreadView extends View {
|
|
25
|
-
/**
|
|
26
|
-
* The list of comment views. It should be used as a part of the view template when present.
|
|
27
|
-
*/
|
|
28
|
-
commentsListView: CommentsListView | null;
|
|
29
|
-
/**
|
|
30
|
-
* The comment input area view. It should be used as a part of the view template when present.
|
|
31
|
-
*/
|
|
32
|
-
commentThreadInputView: CommentThreadInputView | null;
|
|
33
|
-
/**
|
|
34
|
-
* A boolean value that informs if the comment thread view is in the active state ("highlighted").
|
|
35
|
-
* A comment thread view is in this state when it is focused or was activated by the user in any different way.
|
|
36
|
-
*
|
|
37
|
-
* @observable
|
|
38
|
-
*/
|
|
39
|
-
isActive: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Suggestion creation date.
|
|
42
|
-
*
|
|
43
|
-
* @observable
|
|
44
|
-
*/
|
|
45
|
-
authoredAt: Date | null;
|
|
46
|
-
/**
|
|
47
|
-
* Flag that indicates whether suggestion acceptation is possible.
|
|
48
|
-
*
|
|
49
|
-
* @observable
|
|
50
|
-
*/
|
|
51
|
-
canAccept: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Flag that indicates whether suggestion discarding is possible.
|
|
54
|
-
*
|
|
55
|
-
* @observable
|
|
56
|
-
*/
|
|
57
|
-
canDiscard: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Stores description entries generated for this suggestion that describe what is the suggested change.
|
|
60
|
-
* They are used to create the final description presented in the suggestion view to the user.
|
|
61
|
-
*
|
|
62
|
-
* Note that one suggestion may include multiple changes.
|
|
63
|
-
*
|
|
64
|
-
* Most cases are simple and include just one description item:
|
|
65
|
-
*
|
|
66
|
-
* ```ts
|
|
67
|
-
* [
|
|
68
|
-
* { type: 'insertion', content: '*Insert:* "Foo"' }
|
|
69
|
-
* ]
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* This description item represents a suggestion for inserting the "Foo" text. The `type` property describes the performed action
|
|
73
|
-
* while the `content` property contains additional information about the action and is optional.
|
|
74
|
-
*
|
|
75
|
-
* A more complex example is presented below:
|
|
76
|
-
*
|
|
77
|
-
* ```ts
|
|
78
|
-
* [
|
|
79
|
-
* { type: 'insertion', content: '*Insert:* 2 paragraphs' },
|
|
80
|
-
* { type: 'insertion', content: '*Insert:* image' },
|
|
81
|
-
* { type: 'replace', content: '*Replace:* "Foo" *with* "Bar"' }
|
|
82
|
-
* ]
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* In this example, there are three description instances (or lines). Two new (empty) paragraphs were added,
|
|
86
|
-
* an image was added and then "Foo" text was replaced by "Bar". The above structure could be rendered as:
|
|
87
|
-
*
|
|
88
|
-
* ```html
|
|
89
|
-
* <p><strong>Insert:</strong> 2 paragraphs</p>
|
|
90
|
-
* <p><strong>Insert:</strong> image</p>
|
|
91
|
-
* <p><strong>Replace:</strong> "Foo" <strong>with</strong> "Bar"</p>
|
|
92
|
-
* ```
|
|
93
|
-
*
|
|
94
|
-
* @observable
|
|
95
|
-
*/
|
|
96
|
-
descriptionParts: Array<Description>;
|
|
97
|
-
/**
|
|
98
|
-
* Informs whether the suggestion thread has any changes that have not been saved.
|
|
99
|
-
*
|
|
100
|
-
* @observable
|
|
101
|
-
*/
|
|
102
|
-
isDirty: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* Informs whether the suggestion can be accepted or discarded.
|
|
105
|
-
*
|
|
106
|
-
* @observable
|
|
107
|
-
*/
|
|
108
|
-
isEnabled: boolean;
|
|
109
|
-
/**
|
|
110
|
-
* The number of items in the view, where the suggestion itself counts as one.
|
|
111
|
-
*
|
|
112
|
-
* In other words, it is equal to the number of comments in the suggestion thread view plus one.
|
|
113
|
-
*
|
|
114
|
-
* @observable
|
|
115
|
-
*/
|
|
116
|
-
readonly length: number;
|
|
117
|
-
constructor(locale: Locale, model: Suggestion, localUser: User, config: SuggestionThreadConfig);
|
|
118
|
-
/**
|
|
119
|
-
* Focuses the view.
|
|
120
|
-
*/
|
|
121
|
-
focus(): void;
|
|
122
|
-
/**
|
|
123
|
-
* @inheritDoc
|
|
124
|
-
*/
|
|
125
|
-
destroy(): void;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Fired when a user performed an action that should lead to accepting the suggestion.
|
|
129
|
-
*
|
|
130
|
-
* This event is not fired by default by any component created by `BaseSuggestionThreadView`.
|
|
131
|
-
* If you create a view class extending `BaseSuggestionCommentView`, you should provide
|
|
132
|
-
* a UI element that will fire this event.
|
|
133
|
-
*
|
|
134
|
-
* @eventName ~BaseSuggestionThreadView#acceptSuggestion
|
|
135
|
-
*/
|
|
136
|
-
export type AcceptSuggestionEvent = {
|
|
137
|
-
name: 'acceptSuggestion';
|
|
138
|
-
args: [];
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Fired when a user performed an action that should lead to discarding the suggestion.
|
|
142
|
-
*
|
|
143
|
-
* This event is not fired by default by any component created by `BaseSuggestionThreadView`.
|
|
144
|
-
* If you create a view class extending `BaseSuggestionCommentView`, you should provide
|
|
145
|
-
* a UI element that will fire this event.
|
|
146
|
-
*
|
|
147
|
-
* @eventName ~BaseSuggestionThreadView#discardSuggestion
|
|
148
|
-
*/
|
|
149
|
-
export type DiscardSuggestionEvent = {
|
|
150
|
-
name: 'discardSuggestion';
|
|
151
|
-
args: [];
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* Config used for suggestion thread views.
|
|
155
|
-
*/
|
|
156
|
-
export interface SuggestionThreadConfig {
|
|
157
|
-
disableComments: boolean;
|
|
158
|
-
editorConfig: EditorConfig;
|
|
159
|
-
maxCommentsWhenCollapsed: number;
|
|
160
|
-
maxThreadTotalWeight: number;
|
|
161
|
-
maxCommentCharsWhenCollapsed: number;
|
|
162
|
-
formatDateTime: (date: Date | string) => string;
|
|
163
|
-
CommentView: typeof CommentView;
|
|
164
|
-
CommentsListView: typeof CommentsListView;
|
|
165
|
-
CommentThreadInputView: typeof CommentThreadInputView;
|
|
166
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @module track-changes/ui/view/basesuggestionthreadview
|
|
3
|
+
* @publicApi
|
|
4
|
+
*/
|
|
5
|
+
import { View } from 'ckeditor5/src/ui.js';
|
|
6
|
+
import type { Locale } from 'ckeditor5/src/utils.js';
|
|
7
|
+
import type { EditorConfig } from 'ckeditor5/src/core.js';
|
|
8
|
+
import type Suggestion from '../../suggestion.js';
|
|
9
|
+
import type { CommentsListView, CommentThreadInputView, CommentView } from '@ckeditor/ckeditor5-comments';
|
|
10
|
+
import type { User } from 'ckeditor5-collaboration';
|
|
11
|
+
import type { Description } from '../../suggestiondescriptionfactory.js';
|
|
12
|
+
/**
|
|
13
|
+
* An abstract suggestion thread view class that should be used as a base for suggestion thread view implementations.
|
|
14
|
+
* It provides some behaviors, flags and building blocks to use when creating a custom suggestion thread view class.
|
|
15
|
+
*
|
|
16
|
+
* All events fired by {@link module:comments/comments/ui/view/basecommentview~BaseCommentView}
|
|
17
|
+
* are delegated to {@link module:track-changes/ui/view/basesuggestionthreadview~BaseSuggestionThreadView}.
|
|
18
|
+
* This means that {@link module:track-changes/ui/view/basesuggestionthreadview~BaseSuggestionThreadView} can also fire these
|
|
19
|
+
* events to communicate with CKEditor 5 collaboration features.
|
|
20
|
+
*
|
|
21
|
+
* For the usage examples check the {@glink features/collaboration/annotations/annotations-custom-view
|
|
22
|
+
* Annotations custom view} guide.
|
|
23
|
+
*/
|
|
24
|
+
export default abstract class BaseSuggestionThreadView extends View {
|
|
25
|
+
/**
|
|
26
|
+
* The list of comment views. It should be used as a part of the view template when present.
|
|
27
|
+
*/
|
|
28
|
+
commentsListView: CommentsListView | null;
|
|
29
|
+
/**
|
|
30
|
+
* The comment input area view. It should be used as a part of the view template when present.
|
|
31
|
+
*/
|
|
32
|
+
commentThreadInputView: CommentThreadInputView | null;
|
|
33
|
+
/**
|
|
34
|
+
* A boolean value that informs if the comment thread view is in the active state ("highlighted").
|
|
35
|
+
* A comment thread view is in this state when it is focused or was activated by the user in any different way.
|
|
36
|
+
*
|
|
37
|
+
* @observable
|
|
38
|
+
*/
|
|
39
|
+
isActive: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Suggestion creation date.
|
|
42
|
+
*
|
|
43
|
+
* @observable
|
|
44
|
+
*/
|
|
45
|
+
authoredAt: Date | null;
|
|
46
|
+
/**
|
|
47
|
+
* Flag that indicates whether suggestion acceptation is possible.
|
|
48
|
+
*
|
|
49
|
+
* @observable
|
|
50
|
+
*/
|
|
51
|
+
canAccept: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Flag that indicates whether suggestion discarding is possible.
|
|
54
|
+
*
|
|
55
|
+
* @observable
|
|
56
|
+
*/
|
|
57
|
+
canDiscard: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Stores description entries generated for this suggestion that describe what is the suggested change.
|
|
60
|
+
* They are used to create the final description presented in the suggestion view to the user.
|
|
61
|
+
*
|
|
62
|
+
* Note that one suggestion may include multiple changes.
|
|
63
|
+
*
|
|
64
|
+
* Most cases are simple and include just one description item:
|
|
65
|
+
*
|
|
66
|
+
* ```ts
|
|
67
|
+
* [
|
|
68
|
+
* { type: 'insertion', content: '*Insert:* "Foo"' }
|
|
69
|
+
* ]
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* This description item represents a suggestion for inserting the "Foo" text. The `type` property describes the performed action
|
|
73
|
+
* while the `content` property contains additional information about the action and is optional.
|
|
74
|
+
*
|
|
75
|
+
* A more complex example is presented below:
|
|
76
|
+
*
|
|
77
|
+
* ```ts
|
|
78
|
+
* [
|
|
79
|
+
* { type: 'insertion', content: '*Insert:* 2 paragraphs' },
|
|
80
|
+
* { type: 'insertion', content: '*Insert:* image' },
|
|
81
|
+
* { type: 'replace', content: '*Replace:* "Foo" *with* "Bar"' }
|
|
82
|
+
* ]
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* In this example, there are three description instances (or lines). Two new (empty) paragraphs were added,
|
|
86
|
+
* an image was added and then "Foo" text was replaced by "Bar". The above structure could be rendered as:
|
|
87
|
+
*
|
|
88
|
+
* ```html
|
|
89
|
+
* <p><strong>Insert:</strong> 2 paragraphs</p>
|
|
90
|
+
* <p><strong>Insert:</strong> image</p>
|
|
91
|
+
* <p><strong>Replace:</strong> "Foo" <strong>with</strong> "Bar"</p>
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @observable
|
|
95
|
+
*/
|
|
96
|
+
descriptionParts: Array<Description>;
|
|
97
|
+
/**
|
|
98
|
+
* Informs whether the suggestion thread has any changes that have not been saved.
|
|
99
|
+
*
|
|
100
|
+
* @observable
|
|
101
|
+
*/
|
|
102
|
+
isDirty: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Informs whether the suggestion can be accepted or discarded.
|
|
105
|
+
*
|
|
106
|
+
* @observable
|
|
107
|
+
*/
|
|
108
|
+
isEnabled: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* The number of items in the view, where the suggestion itself counts as one.
|
|
111
|
+
*
|
|
112
|
+
* In other words, it is equal to the number of comments in the suggestion thread view plus one.
|
|
113
|
+
*
|
|
114
|
+
* @observable
|
|
115
|
+
*/
|
|
116
|
+
readonly length: number;
|
|
117
|
+
constructor(locale: Locale, model: Suggestion, localUser: User, config: SuggestionThreadConfig);
|
|
118
|
+
/**
|
|
119
|
+
* Focuses the view.
|
|
120
|
+
*/
|
|
121
|
+
focus(): void;
|
|
122
|
+
/**
|
|
123
|
+
* @inheritDoc
|
|
124
|
+
*/
|
|
125
|
+
destroy(): void;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Fired when a user performed an action that should lead to accepting the suggestion.
|
|
129
|
+
*
|
|
130
|
+
* This event is not fired by default by any component created by `BaseSuggestionThreadView`.
|
|
131
|
+
* If you create a view class extending `BaseSuggestionCommentView`, you should provide
|
|
132
|
+
* a UI element that will fire this event.
|
|
133
|
+
*
|
|
134
|
+
* @eventName ~BaseSuggestionThreadView#acceptSuggestion
|
|
135
|
+
*/
|
|
136
|
+
export type AcceptSuggestionEvent = {
|
|
137
|
+
name: 'acceptSuggestion';
|
|
138
|
+
args: [];
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Fired when a user performed an action that should lead to discarding the suggestion.
|
|
142
|
+
*
|
|
143
|
+
* This event is not fired by default by any component created by `BaseSuggestionThreadView`.
|
|
144
|
+
* If you create a view class extending `BaseSuggestionCommentView`, you should provide
|
|
145
|
+
* a UI element that will fire this event.
|
|
146
|
+
*
|
|
147
|
+
* @eventName ~BaseSuggestionThreadView#discardSuggestion
|
|
148
|
+
*/
|
|
149
|
+
export type DiscardSuggestionEvent = {
|
|
150
|
+
name: 'discardSuggestion';
|
|
151
|
+
args: [];
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Config used for suggestion thread views.
|
|
155
|
+
*/
|
|
156
|
+
export interface SuggestionThreadConfig {
|
|
157
|
+
disableComments: boolean;
|
|
158
|
+
editorConfig: EditorConfig;
|
|
159
|
+
maxCommentsWhenCollapsed: number;
|
|
160
|
+
maxThreadTotalWeight: number;
|
|
161
|
+
maxCommentCharsWhenCollapsed: number;
|
|
162
|
+
formatDateTime: (date: Date | string) => string;
|
|
163
|
+
CommentView: typeof CommentView;
|
|
164
|
+
CommentsListView: typeof CommentsListView;
|
|
165
|
+
CommentThreadInputView: typeof CommentThreadInputView;
|
|
166
|
+
}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x349e=['disabledSubmit','CommentView','bind','assign','isEnabled','_localUser','_createCommentThreadInputView','_model','hasDirtyComment','disableComments','locale','removeComment','editor','_createCommentViews','fire','set','commentsListView','isActive','_config','isReadOnly','element','submit','isDirty','commentThreadInputView','focus','descriptionParts','value','destroy','commentThread','updateComment','setData','editorConfig','commentInputView','length','authoredAt','addComment','delegate'];(function(_0x1865f8,_0x349eb0){const _0x52e6f4=function(_0x399643){while(--_0x399643){_0x1865f8['push'](_0x1865f8['shift']());}};_0x52e6f4(++_0x349eb0);}(_0x349e,0xca));const _0x52e6=function(_0x1865f8,_0x349eb0){_0x1865f8=_0x1865f8-0x0;let _0x52e6f4=_0x349e[_0x1865f8];return _0x52e6f4;};import{View as _0x3529be}from'ckeditor5/src/ui.js';export default class ss extends _0x3529be{constructor(_0x210794,_0x3b727b,_0x4f957d,_0x47e00a){super(_0x210794),this[_0x52e6('0x24')]=null,this[_0x52e6('0x6')]=null,this[_0x52e6('0x23')](_0x52e6('0x0'),!0x1),this['set']('authoredAt',_0x3b727b[_0x52e6('0x11')]),this[_0x52e6('0x16')](_0x52e6('0x11'))['to'](_0x3b727b),this[_0x52e6('0x23')](_0x52e6('0x8'),[]),this[_0x52e6('0x23')](_0x52e6('0x5'),!0x1),this[_0x52e6('0x23')](_0x52e6('0x18'),!0x1),this[_0x52e6('0x23')]('canAccept',!0x1),this[_0x52e6('0x23')]('canDiscard',!0x1),this['_model']=_0x3b727b,this[_0x52e6('0x19')]=_0x4f957d,this[_0x52e6('0x1')]=_0x47e00a,_0x47e00a[_0x52e6('0x1d')]?this[_0x52e6('0x23')](_0x52e6('0x10'),0x1):this[_0x52e6('0x21')]();}[_0x52e6('0x7')](){this[_0x52e6('0x3')][_0x52e6('0x7')]();}[_0x52e6('0xa')](){this['commentsListView']&&this[_0x52e6('0x24')]['destroy'](),this[_0x52e6('0x6')]&&this[_0x52e6('0x6')][_0x52e6('0xa')](),super[_0x52e6('0xa')]();}[_0x52e6('0x21')](){const {CommentsListView:_0x5e2ad4}=this[_0x52e6('0x1')];this['commentsListView']=new _0x5e2ad4(this[_0x52e6('0x1e')],this[_0x52e6('0x1b')][_0x52e6('0xb')],Object[_0x52e6('0x17')]({'CommentView':this[_0x52e6('0x1')][_0x52e6('0x15')]},this['_config'])),this[_0x52e6('0x24')]['delegate'](_0x52e6('0x1f'))['to'](this),this[_0x52e6('0x24')][_0x52e6('0x13')](_0x52e6('0xc'))['to'](this),this['commentsListView']['bind'](_0x52e6('0x0'))['to'](this),this[_0x52e6('0x23')](_0x52e6('0x10'),this['commentsListView'][_0x52e6('0x10')]+0x1),this[_0x52e6('0x16')]('length')['to'](this['commentsListView'],_0x52e6('0x10'),_0x17c0bb=>_0x17c0bb+0x1),this['commentThreadInputView']=this[_0x52e6('0x1a')](),this['on'](_0x52e6('0x1f'),()=>this[_0x52e6('0x7')]()),this[_0x52e6('0x16')](_0x52e6('0x5'))['to'](this[_0x52e6('0x24')],_0x52e6('0x1c'),this['commentThreadInputView'][_0x52e6('0xf')],'value',(_0x248e3d,_0xb99225)=>_0x248e3d||!!_0xb99225);}[_0x52e6('0x1a')](){const {CommentThreadInputView:_0xdbe54e}=this[_0x52e6('0x1')],_0x2f75e6=new _0xdbe54e(this[_0x52e6('0x1e')],this['_localUser'],this[_0x52e6('0x1')][_0x52e6('0xe')]),_0x4c5b28=_0x2f75e6[_0x52e6('0xf')];return _0x2f75e6[_0x52e6('0x16')]('showInput')['to'](this,'isActive',this[_0x52e6('0x1b')][_0x52e6('0xb')],_0x52e6('0x2'),_0x4c5b28,_0x52e6('0x9'),(_0x54f1f4,_0x59104a,_0x3240b2)=>!!_0x3240b2||_0x54f1f4&&!_0x59104a),_0x4c5b28['on'](_0x52e6('0x4'),(_0x3fff22,_0x3c420c)=>{this[_0x52e6('0x22')](_0x52e6('0x12'),_0x3c420c),_0x4c5b28[_0x52e6('0x20')][_0x52e6('0xd')]('');}),_0x4c5b28['on']('cancel',()=>this[_0x52e6('0x7')]()),_0x4c5b28[_0x52e6('0x16')](_0x52e6('0x14'))['to'](this[_0x52e6('0x1b')]['commentThread'],_0x52e6('0x2')),_0x2f75e6;}}
|