@ckeditor/ckeditor5-track-changes 38.0.1 → 38.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/build/track-changes.js +1 -1
  2. package/package.json +10 -8
  3. package/src/augmentation.d.ts +36 -36
  4. package/src/commands/acceptsuggestioncommand.d.ts +20 -20
  5. package/src/commands/acceptsuggestioncommand.js +1 -1
  6. package/src/commands/discardsuggestioncommand.d.ts +20 -20
  7. package/src/commands/discardsuggestioncommand.js +1 -1
  8. package/src/commands/executeonallsuggestionscommand.d.ts +20 -20
  9. package/src/commands/executeonallsuggestionscommand.js +1 -1
  10. package/src/commands/executeonselectedsuggestionscommand.d.ts +20 -20
  11. package/src/commands/executeonselectedsuggestionscommand.js +1 -1
  12. package/src/commands/trackchangescommand.d.ts +22 -22
  13. package/src/commands/trackchangescommand.js +1 -1
  14. package/src/index.d.ts +12 -12
  15. package/src/integrations/alignment.d.ts +13 -13
  16. package/src/integrations/alignment.js +1 -1
  17. package/src/integrations/basicstyles.d.ts +13 -13
  18. package/src/integrations/basicstyles.js +1 -1
  19. package/src/integrations/blockquote.d.ts +13 -13
  20. package/src/integrations/blockquote.js +1 -1
  21. package/src/integrations/ckbox.d.ts +13 -13
  22. package/src/integrations/ckbox.js +1 -1
  23. package/src/integrations/codeblock.d.ts +13 -13
  24. package/src/integrations/codeblock.js +1 -1
  25. package/src/integrations/comments.d.ts +10 -10
  26. package/src/integrations/comments.js +1 -1
  27. package/src/integrations/deletecommand.d.ts +13 -12
  28. package/src/integrations/deletecommand.js +1 -1
  29. package/src/integrations/documentlist.d.ts +13 -13
  30. package/src/integrations/documentlist.js +1 -1
  31. package/src/integrations/documentlistproperties.d.ts +25 -25
  32. package/src/integrations/documentlistproperties.js +1 -1
  33. package/src/integrations/entercommand.d.ts +12 -11
  34. package/src/integrations/entercommand.js +1 -1
  35. package/src/integrations/findandreplace.d.ts +17 -17
  36. package/src/integrations/findandreplace.js +1 -1
  37. package/src/integrations/font.d.ts +13 -13
  38. package/src/integrations/font.js +1 -1
  39. package/src/integrations/formatpainter.d.ts +13 -13
  40. package/src/integrations/formatpainter.js +1 -1
  41. package/src/integrations/heading.d.ts +13 -13
  42. package/src/integrations/heading.js +1 -1
  43. package/src/integrations/highlight.d.ts +13 -13
  44. package/src/integrations/highlight.js +1 -1
  45. package/src/integrations/horizontalline.d.ts +13 -13
  46. package/src/integrations/horizontalline.js +1 -1
  47. package/src/integrations/htmlembed.d.ts +13 -13
  48. package/src/integrations/htmlembed.js +1 -1
  49. package/src/integrations/image.d.ts +13 -13
  50. package/src/integrations/image.js +1 -1
  51. package/src/integrations/imagereplace.d.ts +19 -19
  52. package/src/integrations/imagereplace.js +1 -1
  53. package/src/integrations/importword.d.ts +14 -14
  54. package/src/integrations/importword.js +1 -1
  55. package/src/integrations/indent.d.ts +13 -13
  56. package/src/integrations/indent.js +1 -1
  57. package/src/integrations/inputcommand.d.ts +12 -11
  58. package/src/integrations/inputcommand.js +1 -1
  59. package/src/integrations/link.d.ts +13 -13
  60. package/src/integrations/link.js +1 -1
  61. package/src/integrations/list.d.ts +13 -13
  62. package/src/integrations/list.js +1 -1
  63. package/src/integrations/listproperties.d.ts +25 -25
  64. package/src/integrations/listproperties.js +1 -1
  65. package/src/integrations/mediaembed.d.ts +13 -13
  66. package/src/integrations/mediaembed.js +1 -1
  67. package/src/integrations/mention.d.ts +13 -13
  68. package/src/integrations/mention.js +1 -1
  69. package/src/integrations/pagebreak.d.ts +13 -13
  70. package/src/integrations/pagebreak.js +1 -1
  71. package/src/integrations/paragraph.d.ts +13 -13
  72. package/src/integrations/paragraph.js +1 -1
  73. package/src/integrations/removeformat.d.ts +13 -13
  74. package/src/integrations/removeformat.js +1 -1
  75. package/src/integrations/restrictededitingmode.d.ts +13 -13
  76. package/src/integrations/restrictededitingmode.js +1 -1
  77. package/src/integrations/shiftentercommand.d.ts +12 -11
  78. package/src/integrations/shiftentercommand.js +1 -1
  79. package/src/integrations/standardeditingmode.d.ts +13 -13
  80. package/src/integrations/standardeditingmode.js +1 -1
  81. package/src/integrations/style.d.ts +14 -14
  82. package/src/integrations/style.js +1 -1
  83. package/src/integrations/table.d.ts +38 -38
  84. package/src/integrations/table.js +1 -1
  85. package/src/integrations/tablecaption.d.ts +18 -17
  86. package/src/integrations/tablecaption.js +1 -1
  87. package/src/integrations/tableclipboard.d.ts +18 -17
  88. package/src/integrations/tableclipboard.js +1 -1
  89. package/src/integrations/tablecolumnresize.d.ts +22 -22
  90. package/src/integrations/tablecolumnresize.js +1 -1
  91. package/src/integrations/tableheadings.d.ts +18 -17
  92. package/src/integrations/tableheadings.js +1 -1
  93. package/src/integrations/tablemergesplit.d.ts +18 -17
  94. package/src/integrations/tablemergesplit.js +1 -1
  95. package/src/integrations/tableofcontents.d.ts +13 -13
  96. package/src/integrations/tableofcontents.js +1 -1
  97. package/src/integrations/tableproperties.d.ts +23 -23
  98. package/src/integrations/tableproperties.js +1 -1
  99. package/src/integrations/template.d.ts +13 -13
  100. package/src/integrations/template.js +1 -1
  101. package/src/integrations/title.d.ts +13 -13
  102. package/src/integrations/title.js +1 -1
  103. package/src/integrations/undo.d.ts +13 -13
  104. package/src/integrations/undo.js +1 -1
  105. package/src/integrations/utils.d.ts +17 -17
  106. package/src/integrations/utils.js +1 -1
  107. package/src/suggestion.d.ts +266 -266
  108. package/src/suggestion.js +1 -1
  109. package/src/suggestiondescriptionfactory.d.ts +151 -151
  110. package/src/suggestiondescriptionfactory.js +1 -1
  111. package/src/trackchanges.d.ts +240 -240
  112. package/src/trackchanges.js +1 -1
  113. package/src/trackchangesconfig.d.ts +71 -71
  114. package/src/trackchangesdata.d.ts +37 -38
  115. package/src/trackchangesdata.js +1 -1
  116. package/src/trackchangesediting.d.ts +435 -391
  117. package/src/trackchangesediting.js +1 -1
  118. package/src/trackchangesui.d.ts +34 -34
  119. package/src/trackchangesui.js +1 -1
  120. package/src/ui/suggestioncontroller.d.ts +36 -36
  121. package/src/ui/suggestioncontroller.js +1 -1
  122. package/src/ui/view/basesuggestionthreadview.d.ts +166 -166
  123. package/src/ui/view/basesuggestionthreadview.js +1 -1
  124. package/src/ui/view/suggestionthreadview.d.ts +182 -184
  125. package/src/ui/view/suggestionthreadview.js +1 -1
  126. package/src/utils/common-translations.d.ts +5 -5
  127. package/src/utils/common-translations.js +1 -1
  128. package/src/utils/utils.d.ts +26 -26
  129. package/src/utils/utils.js +1 -1
@@ -1,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';
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 {};
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x206e=['canDiscard','_removePendingAction','commentThreadController','canAccept','add','get','_setPendingAction','change:isDirty','_editor','unbind','remove','canEditAt','_discardCommand','stopListening','_acceptCommand','locale','PENDING_ACTION_SUGGESTION','PendingActions','plugins','bind','isDirty','discardSuggestion','isEnabled','_pendingAction','execute','listenTo','commands','view','destroy','acceptSuggestion','model'];(function(_0x322f83,_0x206e7e){const _0x5e41cd=function(_0x557060){while(--_0x557060){_0x322f83['push'](_0x322f83['shift']());}};_0x5e41cd(++_0x206e7e);}(_0x206e,0x137));const _0x5e41=function(_0x322f83,_0x206e7e){_0x322f83=_0x322f83-0x0;let _0x5e41cd=_0x206e[_0x322f83];return _0x5e41cd;};import{ObservableMixin as _0xf71d0f}from'ckeditor5/src/utils';import{getTranslation as _0x240373}from'../utils/common-translations';export default class qt extends _0xf71d0f(){constructor(_0x373fcf,_0x140264,_0x45ad8c,_0x1484b0){super(),this[_0x5e41('0x1d')]=_0x140264,this[_0x5e41('0x1a')]=_0x45ad8c,this['commentThreadController']=_0x1484b0,this[_0x5e41('0x7')]=_0x373fcf,this['_acceptCommand']=_0x373fcf['commands'][_0x5e41('0x4')](_0x5e41('0x1c')),this[_0x5e41('0xb')]=_0x373fcf[_0x5e41('0x19')][_0x5e41('0x4')](_0x5e41('0x14')),this['view'][_0x5e41('0x12')](_0x5e41('0x15'))['to'](this[_0x5e41('0xd')],this['_discardCommand'],(_0x4e7064,_0x27b1c6)=>_0x4e7064||_0x27b1c6),this['view'][_0x5e41('0x12')]('canAccept')['to'](this[_0x5e41('0xd')],'isEnabled',_0x1e8945=>_0x1e8945&&this[_0x5e41('0x7')][_0x5e41('0x1d')][_0x5e41('0xa')](_0x140264['getRanges']())),this['view'][_0x5e41('0x12')](_0x5e41('0x1e'))['to'](this[_0x5e41('0xb')],_0x5e41('0x15'),_0x4c1cbf=>_0x4c1cbf&&this[_0x5e41('0x7')]['model']['canEditAt'](_0x140264['getRanges']())),this[_0x5e41('0x16')]=null,_0x45ad8c[_0x5e41('0x13')]&&this['_setPendingAction'](),this[_0x5e41('0x18')](_0x45ad8c,_0x5e41('0x1c'),()=>this['acceptSuggestion']()),this['listenTo'](_0x45ad8c,_0x5e41('0x14'),()=>this[_0x5e41('0x14')]()),this[_0x5e41('0x18')](_0x45ad8c,_0x5e41('0x6'),()=>{_0x45ad8c[_0x5e41('0x13')]?this['_setPendingAction']():this[_0x5e41('0x0')]();});}[_0x5e41('0x1c')](){this['_acceptCommand'][_0x5e41('0x17')](this[_0x5e41('0x1d')]['id']);}[_0x5e41('0x14')](){this[_0x5e41('0xb')][_0x5e41('0x17')](this[_0x5e41('0x1d')]['id']);}[_0x5e41('0x1b')](){this[_0x5e41('0x1a')][_0x5e41('0x8')](_0x5e41('0x15')),this['view']['unbind'](_0x5e41('0x2')),this['view']['unbind']('canDiscard'),this[_0x5e41('0xc')](),this[_0x5e41('0x1')][_0x5e41('0x1b')](),this['_pendingAction']&&this['_removePendingAction']();}[_0x5e41('0x5')](){const _0x4c2a4d=_0x240373(this[_0x5e41('0x7')][_0x5e41('0xe')],_0x5e41('0xf'));this[_0x5e41('0x16')]=this['_editor'][_0x5e41('0x11')][_0x5e41('0x4')](_0x5e41('0x10'))[_0x5e41('0x3')](_0x4c2a4d);}[_0x5e41('0x0')](){null!==this[_0x5e41('0x16')]&&this[_0x5e41('0x7')][_0x5e41('0x11')][_0x5e41('0x4')](_0x5e41('0x10'))[_0x5e41('0x9')](this[_0x5e41('0x16')]),this[_0x5e41('0x16')]=null;}}
23
+ const _0x507d=['change:isDirty','_acceptCommand','_discardCommand','isDirty','PENDING_ACTION_SUGGESTION','canDiscard','unbind','commands','PendingActions','model','remove','discardSuggestion','execute','_removePendingAction','canAccept','_pendingAction','get','_setPendingAction','listenTo','_editor','plugins','locale','acceptSuggestion','add','getRanges','isEnabled','destroy','bind','commentThreadController','view'];(function(_0x2b4052,_0x507d9c){const _0x2e4c2f=function(_0x5464ab){while(--_0x5464ab){_0x2b4052['push'](_0x2b4052['shift']());}};_0x2e4c2f(++_0x507d9c);}(_0x507d,0x119));const _0x2e4c=function(_0x2b4052,_0x507d9c){_0x2b4052=_0x2b4052-0x0;let _0x2e4c2f=_0x507d[_0x2b4052];return _0x2e4c2f;};import{ObservableMixin as _0x1757a9}from'ckeditor5/src/utils';import{getTranslation as _0x3a65fe}from'../utils/common-translations';export default class qt extends _0x1757a9(){constructor(_0x58e15a,_0x5b96b2,_0x2008ed,_0x2501dc){super(),this[_0x2e4c('0x1c')]=_0x5b96b2,this['view']=_0x2008ed,this[_0x2e4c('0x11')]=_0x2501dc,this[_0x2e4c('0x8')]=_0x58e15a,this[_0x2e4c('0x14')]=_0x58e15a[_0x2e4c('0x1a')][_0x2e4c('0x5')](_0x2e4c('0xb')),this[_0x2e4c('0x15')]=_0x58e15a[_0x2e4c('0x1a')][_0x2e4c('0x5')](_0x2e4c('0x0')),this[_0x2e4c('0x12')][_0x2e4c('0x10')](_0x2e4c('0xe'))['to'](this[_0x2e4c('0x14')],this[_0x2e4c('0x15')],(_0xff0e49,_0x2f8b24)=>_0xff0e49||_0x2f8b24),this[_0x2e4c('0x12')][_0x2e4c('0x10')](_0x2e4c('0x3'))['to'](this['_acceptCommand'],_0x2e4c('0xe'),_0x2c9de7=>_0x2c9de7&&this[_0x2e4c('0x8')]['model']['canEditAt'](_0x5b96b2[_0x2e4c('0xd')]())),this['view'][_0x2e4c('0x10')](_0x2e4c('0x18'))['to'](this[_0x2e4c('0x15')],_0x2e4c('0xe'),_0x40b4d1=>_0x40b4d1&&this[_0x2e4c('0x8')]['model']['canEditAt'](_0x5b96b2[_0x2e4c('0xd')]())),this[_0x2e4c('0x4')]=null,_0x2008ed['isDirty']&&this[_0x2e4c('0x6')](),this['listenTo'](_0x2008ed,'acceptSuggestion',()=>this[_0x2e4c('0xb')]()),this[_0x2e4c('0x7')](_0x2008ed,_0x2e4c('0x0'),()=>this[_0x2e4c('0x0')]()),this[_0x2e4c('0x7')](_0x2008ed,_0x2e4c('0x13'),()=>{_0x2008ed[_0x2e4c('0x16')]?this[_0x2e4c('0x6')]():this[_0x2e4c('0x2')]();});}[_0x2e4c('0xb')](){this['_acceptCommand'][_0x2e4c('0x1')](this[_0x2e4c('0x1c')]['id']);}['discardSuggestion'](){this['_discardCommand'][_0x2e4c('0x1')](this[_0x2e4c('0x1c')]['id']);}[_0x2e4c('0xf')](){this[_0x2e4c('0x12')][_0x2e4c('0x19')](_0x2e4c('0xe')),this[_0x2e4c('0x12')][_0x2e4c('0x19')](_0x2e4c('0x3')),this[_0x2e4c('0x12')][_0x2e4c('0x19')](_0x2e4c('0x18')),this['stopListening'](),this[_0x2e4c('0x11')][_0x2e4c('0xf')](),this['_pendingAction']&&this['_removePendingAction']();}[_0x2e4c('0x6')](){const _0x27ea60=_0x3a65fe(this[_0x2e4c('0x8')][_0x2e4c('0xa')],_0x2e4c('0x17'));this[_0x2e4c('0x4')]=this[_0x2e4c('0x8')]['plugins'][_0x2e4c('0x5')]('PendingActions')[_0x2e4c('0xc')](_0x27ea60);}['_removePendingAction'](){null!==this['_pendingAction']&&this[_0x2e4c('0x8')][_0x2e4c('0x9')][_0x2e4c('0x5')](_0x2e4c('0x1b'))[_0x2e4c('0x1d')](this[_0x2e4c('0x4')]),this['_pendingAction']=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/src/collaboration-core';
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';
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/src/collaboration-core';
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
+ }
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x2e36=['updateComment','authoredAt','value','locale','commentsListView','setData','set','isActive','commentThread','_createCommentViews','element','isDirty','_localUser','destroy','CommentView','editor','fire','commentThreadInputView','commentInputView','_model','hasDirtyComment','isReadOnly','_config','assign','length','editorConfig','isEnabled','delegate','focus','descriptionParts','_createCommentThreadInputView','showInput','submit','canAccept','bind','addComment','disableComments','disabledSubmit'];(function(_0x4b250b,_0x2e3638){const _0x478f3d=function(_0x41607b){while(--_0x41607b){_0x4b250b['push'](_0x4b250b['shift']());}};_0x478f3d(++_0x2e3638);}(_0x2e36,0x19f));const _0x478f=function(_0x4b250b,_0x2e3638){_0x4b250b=_0x4b250b-0x0;let _0x478f3d=_0x2e36[_0x4b250b];return _0x478f3d;};import{View as _0xfc275e}from'ckeditor5/src/ui';export default class ii extends _0xfc275e{constructor(_0x32e0a5,_0x37393d,_0x41219b,_0x4c41e2){super(_0x32e0a5),this[_0x478f('0x7')]=null,this[_0x478f('0x14')]=null,this['set'](_0x478f('0xa'),!0x1),this['set']('authoredAt',_0x37393d[_0x478f('0x4')]),this[_0x478f('0x25')](_0x478f('0x4'))['to'](_0x37393d),this[_0x478f('0x9')](_0x478f('0x20'),[]),this[_0x478f('0x9')](_0x478f('0xe'),!0x1),this[_0x478f('0x9')](_0x478f('0x1d'),!0x1),this[_0x478f('0x9')](_0x478f('0x24'),!0x1),this[_0x478f('0x9')]('canDiscard',!0x1),this[_0x478f('0x16')]=_0x37393d,this[_0x478f('0xf')]=_0x41219b,this[_0x478f('0x19')]=_0x4c41e2,_0x4c41e2[_0x478f('0x1')]?this[_0x478f('0x9')](_0x478f('0x1b'),0x1):this[_0x478f('0xc')]();}[_0x478f('0x1f')](){this[_0x478f('0xd')][_0x478f('0x1f')]();}[_0x478f('0x10')](){this['commentsListView']&&this[_0x478f('0x7')][_0x478f('0x10')](),this['commentThreadInputView']&&this[_0x478f('0x14')][_0x478f('0x10')](),super[_0x478f('0x10')]();}[_0x478f('0xc')](){const {CommentsListView:_0x3c8483}=this['_config'];this[_0x478f('0x7')]=new _0x3c8483(this[_0x478f('0x6')],this[_0x478f('0x16')][_0x478f('0xb')],Object[_0x478f('0x1a')]({'CommentView':this['_config'][_0x478f('0x11')]},this[_0x478f('0x19')])),this[_0x478f('0x7')]['delegate']('removeComment')['to'](this),this[_0x478f('0x7')][_0x478f('0x1e')](_0x478f('0x3'))['to'](this),this['commentsListView'][_0x478f('0x25')](_0x478f('0xa'))['to'](this),this[_0x478f('0x9')](_0x478f('0x1b'),this[_0x478f('0x7')]['length']+0x1),this['bind']('length')['to'](this['commentsListView'],_0x478f('0x1b'),_0x5d8ddf=>_0x5d8ddf+0x1),this[_0x478f('0x14')]=this[_0x478f('0x21')](),this['on']('removeComment',()=>this[_0x478f('0x1f')]()),this['bind']('isDirty')['to'](this['commentsListView'],_0x478f('0x17'),this[_0x478f('0x14')]['commentInputView'],_0x478f('0x5'),(_0x5bc735,_0xd2fb6c)=>_0x5bc735||!!_0xd2fb6c);}['_createCommentThreadInputView'](){const {CommentThreadInputView:_0x128706}=this[_0x478f('0x19')],_0x8109a8=new _0x128706(this[_0x478f('0x6')],this[_0x478f('0xf')],this[_0x478f('0x19')][_0x478f('0x1c')]),_0x251aa3=_0x8109a8[_0x478f('0x15')];return _0x8109a8[_0x478f('0x25')](_0x478f('0x22'))['to'](this,'isActive',this[_0x478f('0x16')]['commentThread'],'isReadOnly',_0x251aa3,_0x478f('0x5'),(_0x193b19,_0x34f6f4,_0x288a5a)=>!!_0x288a5a||_0x193b19&&!_0x34f6f4),_0x251aa3['on'](_0x478f('0x23'),(_0x74cc30,_0x771d74)=>{this[_0x478f('0x13')](_0x478f('0x0'),_0x771d74),_0x251aa3[_0x478f('0x12')][_0x478f('0x8')]('');}),_0x251aa3['on']('cancel',()=>this['focus']()),_0x251aa3[_0x478f('0x25')](_0x478f('0x2'))['to'](this[_0x478f('0x16')][_0x478f('0xb')],_0x478f('0x18')),_0x8109a8;}}
23
+ const _0x38e6=['updateComment','commentThreadInputView','bind','value','isReadOnly','removeComment','set','commentsListView','authoredAt','commentInputView','disableComments','_createCommentThreadInputView','locale','assign','isActive','_createCommentViews','editor','delegate','element','canDiscard','submit','focus','editorConfig','cancel','hasDirtyComment','CommentView','disabledSubmit','canAccept','isEnabled','_config','_model','length','addComment','commentThread','isDirty','setData','destroy','_localUser','descriptionParts'];(function(_0x5d73fc,_0x38e627){const _0x9734b4=function(_0x34a0d0){while(--_0x34a0d0){_0x5d73fc['push'](_0x5d73fc['shift']());}};_0x9734b4(++_0x38e627);}(_0x38e6,0x1ec));const _0x9734=function(_0x5d73fc,_0x38e627){_0x5d73fc=_0x5d73fc-0x0;let _0x9734b4=_0x38e6[_0x5d73fc];return _0x9734b4;};import{View as _0x260688}from'ckeditor5/src/ui';export default class ii extends _0x260688{constructor(_0x592f4f,_0x8ffc01,_0x32971c,_0xc3447a){super(_0x592f4f),this['commentsListView']=null,this[_0x9734('0x10')]=null,this['set'](_0x9734('0x1d'),!0x1),this[_0x9734('0x15')](_0x9734('0x17'),_0x8ffc01[_0x9734('0x17')]),this['bind']('authoredAt')['to'](_0x8ffc01),this[_0x9734('0x15')](_0x9734('0xe'),[]),this[_0x9734('0x15')]('isDirty',!0x1),this[_0x9734('0x15')](_0x9734('0x4'),!0x1),this[_0x9734('0x15')](_0x9734('0x3'),!0x1),this[_0x9734('0x15')](_0x9734('0x22'),!0x1),this[_0x9734('0x6')]=_0x8ffc01,this[_0x9734('0xd')]=_0x32971c,this[_0x9734('0x5')]=_0xc3447a,_0xc3447a[_0x9734('0x19')]?this[_0x9734('0x15')](_0x9734('0x7'),0x1):this[_0x9734('0x1e')]();}['focus'](){this[_0x9734('0x21')][_0x9734('0x24')]();}['destroy'](){this[_0x9734('0x16')]&&this[_0x9734('0x16')][_0x9734('0xc')](),this[_0x9734('0x10')]&&this['commentThreadInputView'][_0x9734('0xc')](),super['destroy']();}[_0x9734('0x1e')](){const {CommentsListView:_0x43e472}=this[_0x9734('0x5')];this[_0x9734('0x16')]=new _0x43e472(this[_0x9734('0x1b')],this[_0x9734('0x6')][_0x9734('0x9')],Object[_0x9734('0x1c')]({'CommentView':this[_0x9734('0x5')][_0x9734('0x1')]},this[_0x9734('0x5')])),this[_0x9734('0x16')]['delegate']('removeComment')['to'](this),this[_0x9734('0x16')][_0x9734('0x20')](_0x9734('0xf'))['to'](this),this['commentsListView'][_0x9734('0x11')](_0x9734('0x1d'))['to'](this),this['set']('length',this[_0x9734('0x16')][_0x9734('0x7')]+0x1),this[_0x9734('0x11')]('length')['to'](this[_0x9734('0x16')],_0x9734('0x7'),_0x395909=>_0x395909+0x1),this['commentThreadInputView']=this[_0x9734('0x1a')](),this['on'](_0x9734('0x14'),()=>this['focus']()),this[_0x9734('0x11')](_0x9734('0xa'))['to'](this[_0x9734('0x16')],_0x9734('0x0'),this[_0x9734('0x10')]['commentInputView'],_0x9734('0x12'),(_0x3535eb,_0x3f335f)=>_0x3535eb||!!_0x3f335f);}[_0x9734('0x1a')](){const {CommentThreadInputView:_0x71651a}=this[_0x9734('0x5')],_0x5eacfa=new _0x71651a(this['locale'],this[_0x9734('0xd')],this['_config'][_0x9734('0x25')]),_0x533e83=_0x5eacfa[_0x9734('0x18')];return _0x5eacfa[_0x9734('0x11')]('showInput')['to'](this,_0x9734('0x1d'),this['_model']['commentThread'],_0x9734('0x13'),_0x533e83,_0x9734('0x12'),(_0x2ba07e,_0x2fe2ef,_0x2a82ef)=>!!_0x2a82ef||_0x2ba07e&&!_0x2fe2ef),_0x533e83['on'](_0x9734('0x23'),(_0x29e2ae,_0x3a7119)=>{this['fire'](_0x9734('0x8'),_0x3a7119),_0x533e83[_0x9734('0x1f')][_0x9734('0xb')]('');}),_0x533e83['on'](_0x9734('0x26'),()=>this['focus']()),_0x533e83[_0x9734('0x11')](_0x9734('0x2'))['to'](this[_0x9734('0x6')][_0x9734('0x9')],_0x9734('0x13')),_0x5eacfa;}}