@ckeditor/ckeditor5-comments 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.
Files changed (157) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/LICENSE.md +6 -6
  3. package/README.md +14 -14
  4. package/build/comments.js +1 -1
  5. package/build/translations/fa.js +1 -1
  6. package/build/translations/pt-br.js +1 -1
  7. package/lang/translations/af.po +1 -0
  8. package/lang/translations/ar.po +1 -0
  9. package/lang/translations/bg.po +1 -0
  10. package/lang/translations/bn.po +1 -0
  11. package/lang/translations/bs.po +1 -0
  12. package/lang/translations/ca.po +1 -0
  13. package/lang/translations/cs.po +1 -0
  14. package/lang/translations/da.po +1 -0
  15. package/lang/translations/de-ch.po +1 -0
  16. package/lang/translations/de.po +1 -0
  17. package/lang/translations/el.po +1 -0
  18. package/lang/translations/en-au.po +1 -0
  19. package/lang/translations/en.po +1 -0
  20. package/lang/translations/es-co.po +1 -0
  21. package/lang/translations/es.po +1 -0
  22. package/lang/translations/et.po +1 -0
  23. package/lang/translations/fa.po +10 -9
  24. package/lang/translations/fi.po +1 -0
  25. package/lang/translations/fr.po +1 -0
  26. package/lang/translations/gl.po +1 -0
  27. package/lang/translations/he.po +1 -0
  28. package/lang/translations/hi.po +1 -0
  29. package/lang/translations/hr.po +1 -0
  30. package/lang/translations/hu.po +1 -0
  31. package/lang/translations/id.po +1 -0
  32. package/lang/translations/it.po +1 -0
  33. package/lang/translations/ja.po +1 -0
  34. package/lang/translations/jv.po +1 -0
  35. package/lang/translations/ko.po +1 -0
  36. package/lang/translations/lt.po +1 -0
  37. package/lang/translations/lv.po +1 -0
  38. package/lang/translations/ms.po +1 -0
  39. package/lang/translations/nl.po +1 -0
  40. package/lang/translations/no.po +1 -0
  41. package/lang/translations/pl.po +1 -0
  42. package/lang/translations/pt-br.po +4 -3
  43. package/lang/translations/pt.po +1 -0
  44. package/lang/translations/ro.po +1 -0
  45. package/lang/translations/ru.po +1 -0
  46. package/lang/translations/sk.po +1 -0
  47. package/lang/translations/sq.po +1 -0
  48. package/lang/translations/sr-latn.po +1 -0
  49. package/lang/translations/sr.po +1 -0
  50. package/lang/translations/sv.po +1 -0
  51. package/lang/translations/th.po +1 -0
  52. package/lang/translations/tk.po +1 -0
  53. package/lang/translations/tr.po +1 -0
  54. package/lang/translations/tt.po +1 -0
  55. package/lang/translations/ug.po +1 -0
  56. package/lang/translations/uk.po +1 -0
  57. package/lang/translations/ur.po +1 -0
  58. package/lang/translations/vi.po +1 -0
  59. package/lang/translations/zh-cn.po +1 -0
  60. package/lang/translations/zh.po +1 -0
  61. package/package.json +3 -7
  62. package/src/annotations/annotation.d.ts +90 -90
  63. package/src/annotations/annotation.js +1 -1
  64. package/src/annotations/annotationcollection.d.ts +98 -98
  65. package/src/annotations/annotationcollection.js +1 -1
  66. package/src/annotations/annotations.d.ts +154 -154
  67. package/src/annotations/annotations.js +1 -1
  68. package/src/annotations/annotationsuis.d.ts +232 -232
  69. package/src/annotations/annotationsuis.js +1 -1
  70. package/src/annotations/editorannotations.d.ts +67 -67
  71. package/src/annotations/editorannotations.js +1 -1
  72. package/src/annotations/inlineannotations.d.ts +90 -90
  73. package/src/annotations/inlineannotations.js +1 -1
  74. package/src/annotations/narrowsidebar.d.ts +85 -85
  75. package/src/annotations/narrowsidebar.js +1 -1
  76. package/src/annotations/sidebar.d.ts +100 -100
  77. package/src/annotations/sidebar.js +1 -1
  78. package/src/annotations/view/annotationcounterbuttonview.d.ts +29 -29
  79. package/src/annotations/view/annotationcounterbuttonview.js +1 -1
  80. package/src/annotations/view/annotationview.d.ts +90 -90
  81. package/src/annotations/view/annotationview.js +1 -1
  82. package/src/annotations/view/sidebaritemview.d.ts +55 -55
  83. package/src/annotations/view/sidebaritemview.js +1 -1
  84. package/src/annotations/view/sidebarview.d.ts +32 -32
  85. package/src/annotations/view/sidebarview.js +1 -1
  86. package/src/annotations/widesidebar.d.ts +77 -77
  87. package/src/annotations/widesidebar.js +1 -1
  88. package/src/augmentation.d.ts +52 -52
  89. package/src/comments/addcommentthreadcommand.d.ts +35 -35
  90. package/src/comments/addcommentthreadcommand.js +1 -1
  91. package/src/comments/commentsarchive.d.ts +31 -31
  92. package/src/comments/commentsarchive.js +1 -1
  93. package/src/comments/commentsarchiveui.d.ts +38 -38
  94. package/src/comments/commentsarchiveui.js +1 -1
  95. package/src/comments/commentsediting.d.ts +79 -79
  96. package/src/comments/commentsediting.js +1 -1
  97. package/src/comments/commentsrepository.d.ts +1129 -1105
  98. package/src/comments/commentsrepository.js +1 -1
  99. package/src/comments/commentsui.d.ts +33 -33
  100. package/src/comments/commentsui.js +1 -1
  101. package/src/comments/integrations/commentsrestrictededitingmode.d.ts +17 -17
  102. package/src/comments/integrations/commentsrestrictededitingmode.js +1 -1
  103. package/src/comments/integrations/importword.d.ts +21 -21
  104. package/src/comments/integrations/importword.js +1 -1
  105. package/src/comments/ui/commenteditor/commenteditor.d.ts +36 -36
  106. package/src/comments/ui/commenteditor/commenteditor.js +1 -1
  107. package/src/comments/ui/commenteditor/commenteditorui.d.ts +31 -31
  108. package/src/comments/ui/commenteditor/commenteditorui.js +1 -1
  109. package/src/comments/ui/commenteditor/commenteditoruiview.d.ts +36 -36
  110. package/src/comments/ui/commenteditor/commenteditoruiview.js +1 -1
  111. package/src/comments/ui/commentthreadcontroller.d.ts +64 -64
  112. package/src/comments/ui/commentthreadcontroller.js +1 -1
  113. package/src/comments/ui/view/basecommentthreadview.d.ts +119 -112
  114. package/src/comments/ui/view/basecommentthreadview.js +1 -1
  115. package/src/comments/ui/view/basecommentview.d.ts +112 -112
  116. package/src/comments/ui/view/basecommentview.js +1 -1
  117. package/src/comments/ui/view/collapsedcommentsview.d.ts +13 -13
  118. package/src/comments/ui/view/collapsedcommentsview.js +1 -1
  119. package/src/comments/ui/view/commentcontentview.d.ts +14 -14
  120. package/src/comments/ui/view/commentcontentview.js +1 -1
  121. package/src/comments/ui/view/commentinputview.d.ts +86 -86
  122. package/src/comments/ui/view/commentinputview.js +1 -1
  123. package/src/comments/ui/view/commentsarchiveview.d.ts +38 -38
  124. package/src/comments/ui/view/commentsarchiveview.js +1 -1
  125. package/src/comments/ui/view/commentslistview.d.ts +100 -100
  126. package/src/comments/ui/view/commentslistview.js +1 -1
  127. package/src/comments/ui/view/commentthreadheaderview.d.ts +50 -50
  128. package/src/comments/ui/view/commentthreadheaderview.js +1 -1
  129. package/src/comments/ui/view/commentthreadinputview.d.ts +41 -41
  130. package/src/comments/ui/view/commentthreadinputview.js +1 -1
  131. package/src/comments/ui/view/commentthreadview.d.ts +118 -117
  132. package/src/comments/ui/view/commentthreadview.js +1 -1
  133. package/src/comments/ui/view/commentview.d.ts +243 -243
  134. package/src/comments/ui/view/commentview.js +1 -1
  135. package/src/comments.d.ts +35 -35
  136. package/src/comments.js +1 -1
  137. package/src/commentsonly.d.ts +33 -33
  138. package/src/commentsonly.js +1 -1
  139. package/src/config.d.ts +176 -176
  140. package/src/index.d.ts +24 -24
  141. package/src/utils/common-translations.d.ts +9 -9
  142. package/src/utils/common-translations.js +1 -1
  143. package/src/utils/createmutationobserver.d.ts +14 -14
  144. package/src/utils/createmutationobserver.js +1 -1
  145. package/theme/annotation-inline.css +2 -1
  146. package/theme/annotation.css +2 -3
  147. package/theme/comment.css +39 -38
  148. package/theme/commentinput.css +2 -1
  149. package/theme/commentmarker.css +7 -6
  150. package/theme/commentsarchive.css +2 -1
  151. package/theme/commentthread.css +68 -57
  152. package/theme/icons/add-comment.svg +1 -1
  153. package/theme/icons/comments-archive.svg +1 -1
  154. package/theme/icons/edit-comment.svg +1 -1
  155. package/theme/icons/remove-comment.svg +1 -1
  156. package/theme/sidebar-narrow.css +4 -3
  157. package/theme/sidebar.css +13 -12
@@ -1,232 +1,232 @@
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 comments/annotations/annotationsuis
7
- * @publicApi
8
- */
9
- import { ContextPlugin, type Plugin, type Editor, type Context } from 'ckeditor5/src/core';
10
- import { type Emitter } from 'ckeditor5/src/utils';
11
- import AnnotationCollection from './annotationcollection';
12
- import Annotations from './annotations';
13
- import type Annotation from './annotation';
14
- /**
15
- * A repository of annotations UIs.
16
- *
17
- * The main entry point for {@link module:comments/annotations/annotationsuis~AnnotationsUIs#register registering} UIs
18
- * and activating the annotations UI(s), which display annotation views.
19
- *
20
- * To register a custom annotations UI use following code in the annotations UI plugin `init()` function:
21
- *
22
- * ```ts
23
- * const annotationsUIs = editor.plugins.get( 'annotationsUIs' );
24
- *
25
- * annotationsUIs.register( customAnnotationsUIPlugin );
26
- * ```
27
- *
28
- * Note that the custom annotations UI must implement {@link module:comments/annotations/annotationsuis~AnnotationsUI
29
- * the `AnnotationsUI` interface}.
30
- *
31
- * To activate an annotations UI, use the {@link module:comments/annotations/annotationsuis~AnnotationsUIs#switchTo
32
- * `switchTo( uiName )`} method. This method activates the given UI and deactivates all the other UIs.
33
- * All annotations will be handled by the activated UI.
34
- *
35
- * It is also possible to activate multiple annotations UIs at the same time and make the UIs handle different sets of annotations.
36
- * To do that, use the {@link module:comments/annotations/annotationsuis~AnnotationsUIs#activate `activate( uiName, filter )`} method.
37
- *
38
- * ```ts
39
- * // Suggestions annotations are shown inline in a balloon:
40
- * annotationsUIs.activate( 'inline', annotation => annotation.type.startsWith( 'suggestion' ) );
41
- *
42
- * // At the same time, comments annotations are shown in a sidebar:
43
- * annotationsUIs.activate( 'wideSidebar', annotation => annotation.type === 'comment' );
44
- * ```
45
- *
46
- * Limitations:
47
- *
48
- * * Some annotations UI plugins might collide with each other (like {@link module:comments/annotations/narrowsidebar~NarrowSidebar} and
49
- * {@link module:comments/annotations/widesidebar~WideSidebar} that operates on the same sidebar). They cannot be activated at the same
50
- * time.
51
- * * It is not possible to display the same annotation in two different annotations UIs. In this scenario an error will be thrown.
52
- */
53
- export default class AnnotationsUIs extends ContextPlugin {
54
- /**
55
- * A set of names of the active annotations UIs.
56
- *
57
- * To activate the annotations UI, use {@link module:comments/annotations/annotationsuis~AnnotationsUIs#activate}
58
- * or {@link #switchTo} methods.
59
- */
60
- activeUIs: Set<string>;
61
- /**
62
- * @inheritDoc
63
- */
64
- static get requires(): readonly [typeof Annotations];
65
- /**
66
- * @inheritDoc
67
- */
68
- static get pluginName(): "AnnotationsUIs";
69
- /**
70
- * @inheritDoc
71
- */
72
- constructor(context: Context | Editor);
73
- /**
74
- * @inheritDoc
75
- */
76
- init(): void;
77
- /**
78
- * Returns `true` if at least one registered UI is active.
79
- */
80
- hasActive(): boolean;
81
- /**
82
- * Returns `true` if the given UI is active.
83
- */
84
- isActive(uiName: string): boolean;
85
- /**
86
- * Activates an annotations UI.
87
- *
88
- * Note that the custom annotations UI should be {@link #register registered} before the activation.
89
- *
90
- * The `filter` parameter can be used to display on some of the annotations in the given annotations UI. Thanks to that,
91
- * all annotations can be split into various annotations UIs.
92
- *
93
- * The `filter` function takes an {@link module:comments/annotations/annotation~Annotation} instance as the first and only parameter,
94
- * and should return `true` if that annotation should be placed in the given annotations UI.
95
- *
96
- * @param uiName The name of the annotations UI to activate.
97
- * @param filter The annotation filter function. If not specified, the UI will use all annotations.
98
- */
99
- activate(uiName: string, filter?: () => boolean): void;
100
- /**
101
- * Deactivates annotations UI with given name.
102
- *
103
- * @param uiName The name of the annotations UI to deactivate.
104
- */
105
- deactivate(uiName: string): void;
106
- /**
107
- * Switches the annotations UI to the one with given name.
108
- *
109
- * It preserves the currently active annotation.
110
- *
111
- * @param uiName The name of the annotations UI to switch to.
112
- */
113
- switchTo(uiName: string): void;
114
- /**
115
- * Deactivates all annotations UIs.
116
- */
117
- deactivateAll(): void;
118
- /**
119
- * Registers an annotations UI. It might be one of:
120
- *
121
- * * {@link module:comments/annotations/widesidebar~WideSidebar},
122
- * * {@link module:comments/annotations/narrowsidebar~NarrowSidebar},
123
- * * {@link module:comments/annotations/inlineannotations~InlineAnnotations}.
124
- *
125
- * It is possible to provide your own, custom annotations UI plugin. It has to implement
126
- * {@link module:comments/annotations/annotationsuis~AnnotationsUI the `AnnotationsUI` interface}.
127
- *
128
- * @param uiName Annotations UI name.
129
- * @param annotationsUI Annotations UI plugin instance.
130
- */
131
- register(uiName: string, annotationsUI: AnnotationsUI<ContextPlugin | Plugin>): void;
132
- /**
133
- * Refilters annotations to proper UIs based on filters provided earlier during the
134
- * {@link module:comments/annotations/annotationsuis~AnnotationsUIs#activate annotations UIs activation}.
135
- *
136
- * This method should be used if the annotations UIs filtering functions return different results than before
137
- * for some annotations. It only reattaches these annotations, which should change their UIs.
138
- */
139
- refilterAnnotations(): void;
140
- /**
141
- * @inheritDoc
142
- */
143
- destroy(): void;
144
- }
145
- /**
146
- * An interface for the annotations UI plugin class.
147
- *
148
- * The annotations UI class handles displaying, focusing, activating and hiding annotations views.
149
- *
150
- * The annotations UI class must be a plugin, so it has to extend the {@link module:core/plugin~Plugin} or
151
- * {@link module:core/contextplugin~ContextPlugin} class.
152
- *
153
- * Examples of `AnnotationsUI` are:
154
- *
155
- * * {@link module:comments/annotations/widesidebar~WideSidebar},
156
- * * {@link module:comments/annotations/narrowsidebar~NarrowSidebar},
157
- * * {@link module:comments/annotations/inlineannotations~InlineAnnotations}.
158
- *
159
- * You can use the following snippet as a base for your own annotations UI:
160
- *
161
- * ```ts
162
- * class MyAnnotationsUI extends ContextPlugin {
163
- * constructor( ...args ) {
164
- * super( ...args );
165
- *
166
- * this.set( 'activeAnnotation', null );
167
- * }
168
- *
169
- * attach( annotations ) {
170
- * // Do something when an annotation is added.
171
- * this.listenTo( annotations, 'add', ( evt, annotation ) => { ... } );
172
- *
173
- * // Do something when an annotation is removed.
174
- * this.listenTo( annotations, 'remove', ( evt, annotation ) => { ... } );
175
- * }
176
- *
177
- * detach() {
178
- * this.stopListening();
179
- * }
180
- *
181
- * setActiveAnnotation( annotation ) {
182
- * if ( this.activeAnnotation ) {
183
- * this.activeAnnotation.isActive = false;
184
- *
185
- * // You can do something in your UI with the annotation that is no longer active.
186
- * }
187
- *
188
- * this.activeAnnotation = annotation;
189
- * this.activeAnnotation.isActive = true;
190
- *
191
- * // You can do something in your UI to highlight the active annotation.
192
- * }
193
- * }
194
- * ```
195
- */
196
- export interface AnnotationUI {
197
- /**
198
- * Observable `activeAnnotation` property. {@link module:comments/annotations/annotationsuis~AnnotationsUIs} listens to changes on that
199
- * property.
200
- *
201
- * To make this property observable use `this.set( 'activeAnnotation', null )` in the constructor.
202
- */
203
- activeAnnotation: Annotation | null;
204
- /**
205
- * Creates everything needed for the UI and attaches all listeners. This method is called when the UI is activated.
206
- *
207
- * The observable collection of annotations is passed as the first argument,
208
- * and the annotations UI is responsible for reacting to its changes.
209
- */
210
- attach: (annotationCollection: AnnotationCollection) => void;
211
- /**
212
- * Destroys the UI and removes all listeners. This method is called when the UI is deactivated.
213
- */
214
- detach: () => void;
215
- /**
216
- * Sets or unsets the active annotation. This method is called when an annotation is activated, for example, user puts their
217
- * selection into a marker connected with given annotation.
218
- *
219
- * This method should change the UI so the new active annotation is differentiated from other annotations.
220
- *
221
- * This method should set the
222
- * {@link #activeAnnotation `AnnotationUI#activeAnnotation`} property.
223
- *
224
- * It also should set {@link module:comments/annotations/annotation~Annotation#isActive `Annotation#isActive`} of the deactivated
225
- * and the activated annotation.
226
- *
227
- * @param annotation The new active annotation or null when no annotation is active.
228
- */
229
- setActiveAnnotation: (annotation: Annotation | null) => void;
230
- _setSelectedAnnotations?: (annotations: Array<Annotation>) => void;
231
- }
232
- export type AnnotationsUI<T extends Emitter> = T & AnnotationUI;
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 comments/annotations/annotationsuis
7
+ * @publicApi
8
+ */
9
+ import { ContextPlugin, type Plugin, type Editor, type Context } from 'ckeditor5/src/core';
10
+ import { type Emitter } from 'ckeditor5/src/utils';
11
+ import AnnotationCollection from './annotationcollection';
12
+ import Annotations from './annotations';
13
+ import type Annotation from './annotation';
14
+ /**
15
+ * A repository of annotations UIs.
16
+ *
17
+ * The main entry point for {@link module:comments/annotations/annotationsuis~AnnotationsUIs#register registering} UIs
18
+ * and activating the annotations UI(s), which display annotation views.
19
+ *
20
+ * To register a custom annotations UI use following code in the annotations UI plugin `init()` function:
21
+ *
22
+ * ```ts
23
+ * const annotationsUIs = editor.plugins.get( 'annotationsUIs' );
24
+ *
25
+ * annotationsUIs.register( customAnnotationsUIPlugin );
26
+ * ```
27
+ *
28
+ * Note that the custom annotations UI must implement {@link module:comments/annotations/annotationsuis~AnnotationsUI
29
+ * the `AnnotationsUI` interface}.
30
+ *
31
+ * To activate an annotations UI, use the {@link module:comments/annotations/annotationsuis~AnnotationsUIs#switchTo
32
+ * `switchTo( uiName )`} method. This method activates the given UI and deactivates all the other UIs.
33
+ * All annotations will be handled by the activated UI.
34
+ *
35
+ * It is also possible to activate multiple annotations UIs at the same time and make the UIs handle different sets of annotations.
36
+ * To do that, use the {@link module:comments/annotations/annotationsuis~AnnotationsUIs#activate `activate( uiName, filter )`} method.
37
+ *
38
+ * ```ts
39
+ * // Suggestions annotations are shown inline in a balloon:
40
+ * annotationsUIs.activate( 'inline', annotation => annotation.type.startsWith( 'suggestion' ) );
41
+ *
42
+ * // At the same time, comments annotations are shown in a sidebar:
43
+ * annotationsUIs.activate( 'wideSidebar', annotation => annotation.type === 'comment' );
44
+ * ```
45
+ *
46
+ * Limitations:
47
+ *
48
+ * * Some annotations UI plugins might collide with each other (like {@link module:comments/annotations/narrowsidebar~NarrowSidebar} and
49
+ * {@link module:comments/annotations/widesidebar~WideSidebar} that operates on the same sidebar). They cannot be activated at the same
50
+ * time.
51
+ * * It is not possible to display the same annotation in two different annotations UIs. In this scenario an error will be thrown.
52
+ */
53
+ export default class AnnotationsUIs extends ContextPlugin {
54
+ /**
55
+ * A set of names of the active annotations UIs.
56
+ *
57
+ * To activate the annotations UI, use {@link module:comments/annotations/annotationsuis~AnnotationsUIs#activate}
58
+ * or {@link #switchTo} methods.
59
+ */
60
+ activeUIs: Set<string>;
61
+ /**
62
+ * @inheritDoc
63
+ */
64
+ static get requires(): readonly [typeof Annotations];
65
+ /**
66
+ * @inheritDoc
67
+ */
68
+ static get pluginName(): "AnnotationsUIs";
69
+ /**
70
+ * @inheritDoc
71
+ */
72
+ constructor(context: Context | Editor);
73
+ /**
74
+ * @inheritDoc
75
+ */
76
+ init(): void;
77
+ /**
78
+ * Returns `true` if at least one registered UI is active.
79
+ */
80
+ hasActive(): boolean;
81
+ /**
82
+ * Returns `true` if the given UI is active.
83
+ */
84
+ isActive(uiName: string): boolean;
85
+ /**
86
+ * Activates an annotations UI.
87
+ *
88
+ * Note that the custom annotations UI should be {@link #register registered} before the activation.
89
+ *
90
+ * The `filter` parameter can be used to display on some of the annotations in the given annotations UI. Thanks to that,
91
+ * all annotations can be split into various annotations UIs.
92
+ *
93
+ * The `filter` function takes an {@link module:comments/annotations/annotation~Annotation} instance as the first and only parameter,
94
+ * and should return `true` if that annotation should be placed in the given annotations UI.
95
+ *
96
+ * @param uiName The name of the annotations UI to activate.
97
+ * @param filter The annotation filter function. If not specified, the UI will use all annotations.
98
+ */
99
+ activate(uiName: string, filter?: () => boolean): void;
100
+ /**
101
+ * Deactivates annotations UI with given name.
102
+ *
103
+ * @param uiName The name of the annotations UI to deactivate.
104
+ */
105
+ deactivate(uiName: string): void;
106
+ /**
107
+ * Switches the annotations UI to the one with given name.
108
+ *
109
+ * It preserves the currently active annotation.
110
+ *
111
+ * @param uiName The name of the annotations UI to switch to.
112
+ */
113
+ switchTo(uiName: string): void;
114
+ /**
115
+ * Deactivates all annotations UIs.
116
+ */
117
+ deactivateAll(): void;
118
+ /**
119
+ * Registers an annotations UI. It might be one of:
120
+ *
121
+ * * {@link module:comments/annotations/widesidebar~WideSidebar},
122
+ * * {@link module:comments/annotations/narrowsidebar~NarrowSidebar},
123
+ * * {@link module:comments/annotations/inlineannotations~InlineAnnotations}.
124
+ *
125
+ * It is possible to provide your own, custom annotations UI plugin. It has to implement
126
+ * {@link module:comments/annotations/annotationsuis~AnnotationsUI the `AnnotationsUI` interface}.
127
+ *
128
+ * @param uiName Annotations UI name.
129
+ * @param annotationsUI Annotations UI plugin instance.
130
+ */
131
+ register(uiName: string, annotationsUI: AnnotationsUI<ContextPlugin | Plugin>): void;
132
+ /**
133
+ * Refilters annotations to proper UIs based on filters provided earlier during the
134
+ * {@link module:comments/annotations/annotationsuis~AnnotationsUIs#activate annotations UIs activation}.
135
+ *
136
+ * This method should be used if the annotations UIs filtering functions return different results than before
137
+ * for some annotations. It only reattaches these annotations, which should change their UIs.
138
+ */
139
+ refilterAnnotations(): void;
140
+ /**
141
+ * @inheritDoc
142
+ */
143
+ destroy(): void;
144
+ }
145
+ /**
146
+ * An interface for the annotations UI plugin class.
147
+ *
148
+ * The annotations UI class handles displaying, focusing, activating and hiding annotations views.
149
+ *
150
+ * The annotations UI class must be a plugin, so it has to extend the {@link module:core/plugin~Plugin} or
151
+ * {@link module:core/contextplugin~ContextPlugin} class.
152
+ *
153
+ * Examples of `AnnotationsUI` are:
154
+ *
155
+ * * {@link module:comments/annotations/widesidebar~WideSidebar},
156
+ * * {@link module:comments/annotations/narrowsidebar~NarrowSidebar},
157
+ * * {@link module:comments/annotations/inlineannotations~InlineAnnotations}.
158
+ *
159
+ * You can use the following snippet as a base for your own annotations UI:
160
+ *
161
+ * ```ts
162
+ * class MyAnnotationsUI extends ContextPlugin {
163
+ * constructor( ...args ) {
164
+ * super( ...args );
165
+ *
166
+ * this.set( 'activeAnnotation', null );
167
+ * }
168
+ *
169
+ * attach( annotations ) {
170
+ * // Do something when an annotation is added.
171
+ * this.listenTo( annotations, 'add', ( evt, annotation ) => { ... } );
172
+ *
173
+ * // Do something when an annotation is removed.
174
+ * this.listenTo( annotations, 'remove', ( evt, annotation ) => { ... } );
175
+ * }
176
+ *
177
+ * detach() {
178
+ * this.stopListening();
179
+ * }
180
+ *
181
+ * setActiveAnnotation( annotation ) {
182
+ * if ( this.activeAnnotation ) {
183
+ * this.activeAnnotation.isActive = false;
184
+ *
185
+ * // You can do something in your UI with the annotation that is no longer active.
186
+ * }
187
+ *
188
+ * this.activeAnnotation = annotation;
189
+ * this.activeAnnotation.isActive = true;
190
+ *
191
+ * // You can do something in your UI to highlight the active annotation.
192
+ * }
193
+ * }
194
+ * ```
195
+ */
196
+ export interface AnnotationUI {
197
+ /**
198
+ * Observable `activeAnnotation` property. {@link module:comments/annotations/annotationsuis~AnnotationsUIs} listens to changes on that
199
+ * property.
200
+ *
201
+ * To make this property observable use `this.set( 'activeAnnotation', null )` in the constructor.
202
+ */
203
+ activeAnnotation: Annotation | null;
204
+ /**
205
+ * Creates everything needed for the UI and attaches all listeners. This method is called when the UI is activated.
206
+ *
207
+ * The observable collection of annotations is passed as the first argument,
208
+ * and the annotations UI is responsible for reacting to its changes.
209
+ */
210
+ attach: (annotationCollection: AnnotationCollection) => void;
211
+ /**
212
+ * Destroys the UI and removes all listeners. This method is called when the UI is deactivated.
213
+ */
214
+ detach: () => void;
215
+ /**
216
+ * Sets or unsets the active annotation. This method is called when an annotation is activated, for example, user puts their
217
+ * selection into a marker connected with given annotation.
218
+ *
219
+ * This method should change the UI so the new active annotation is differentiated from other annotations.
220
+ *
221
+ * This method should set the
222
+ * {@link #activeAnnotation `AnnotationUI#activeAnnotation`} property.
223
+ *
224
+ * It also should set {@link module:comments/annotations/annotation~Annotation#isActive `Annotation#isActive`} of the deactivated
225
+ * and the activated annotation.
226
+ *
227
+ * @param annotation The new active annotation or null when no annotation is active.
228
+ */
229
+ setActiveAnnotation: (annotation: Annotation | null) => void;
230
+ _setSelectedAnnotations?: (annotations: Array<Annotation>) => void;
231
+ }
232
+ export type AnnotationsUI<T extends Emitter> = T & AnnotationUI;
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x2f6b=['change:activeAnnotation','remove','init','_visibleAnnotations','delete','AnnotationsUIs','_activateAnnotation','type','activeUIs','_assertAnnotationDoesNotBelongToMultipleUIs','_setSelectedAnnotations','activate','stopListening','function','_deactivateAllAnnotations','push','refilterAnnotations','collection','hasActive','find','context','attach','listenTo','isActive','get','length','deactivateAll','deactivate','add','register','from','_uis','activeAnnotations','detach','plugins','setActiveAnnotation','set','has','_removeActiveAnnotation','annotationsuis-missing-ui','annotationsuis-register-already-registered','size','pluginName','_uisData','destroy'];(function(_0x3f1a36,_0x2f6b49){const _0x222e3c=function(_0x31c5c5){while(--_0x31c5c5){_0x3f1a36['push'](_0x3f1a36['shift']());}};_0x222e3c(++_0x2f6b49);}(_0x2f6b,0x16d));const _0x222e=function(_0x3f1a36,_0x2f6b49){_0x3f1a36=_0x3f1a36-0x0;let _0x222e3c=_0x2f6b[_0x3f1a36];return _0x222e3c;};import{ContextPlugin as _0x86448f}from'ckeditor5/src/core';import{CKEditorError as _0x519c9e}from'ckeditor5/src/utils';import _0x45efe3,{bindAnnotationCollections as _0x242ca8}from'./annotationcollection';import _0x5c75f1 from'./annotations';export default class M extends _0x86448f{static get['requires'](){return[_0x5c75f1];}static get[_0x222e('0x25')](){return _0x222e('0x0');}constructor(_0x2f73b5){super(_0x2f73b5),this[_0x222e('0x3')]=new Set(),this[_0x222e('0x1a')]=new Map(),this[_0x222e('0x26')]=new Map();}[_0x222e('0x2a')](){const _0x2e4d1e=this[_0x222e('0xf')][_0x222e('0x1d')][_0x222e('0x13')](_0x5c75f1);this[_0x222e('0x11')](_0x2e4d1e,_0x222e('0x1'),(_0x1fc851,_0x59715a)=>{for(const _0x3f305b of this[_0x222e('0x3')]){const _0x190799=this[_0x222e('0x1a')][_0x222e('0x13')](_0x3f305b);(0x0,this[_0x222e('0x26')][_0x222e('0x13')](_0x3f305b)['filter'])(_0x59715a)&&_0x190799[_0x222e('0x1e')](_0x59715a);}}),this[_0x222e('0x11')](_0x2e4d1e,_0x222e('0x9'),()=>{for(const _0x20f974 of this[_0x222e('0x3')]){this[_0x222e('0x1a')][_0x222e('0x13')](_0x20f974)[_0x222e('0x1e')](null);}}),this[_0x222e('0x11')](_0x2e4d1e['_visibleAnnotations'],_0x222e('0x17'),(_0x44faa0,_0x8dd248)=>{this[_0x222e('0x4')](_0x8dd248);});}[_0x222e('0xd')](){return this[_0x222e('0x3')][_0x222e('0x24')]>0x0;}[_0x222e('0x12')](_0x55785f){return this[_0x222e('0x3')]['has'](_0x55785f);}[_0x222e('0x6')](_0x4f7173,_0x27da01=()=>!0x0){const _0x2b42a=this['context'][_0x222e('0x1d')][_0x222e('0x13')](_0x5c75f1);if(!this[_0x222e('0x1a')][_0x222e('0x20')](_0x4f7173))throw new _0x519c9e(_0x222e('0x22'),this,{'uiName':_0x4f7173});this[_0x222e('0x12')](_0x4f7173)&&this[_0x222e('0x16')](_0x4f7173),this['activeUIs'][_0x222e('0x17')](_0x4f7173);const _0x191c09=new _0x45efe3(),_0x5890f7=_0x2b42a[_0x222e('0x2b')];_0x242ca8({'source':_0x5890f7,'target':_0x191c09,'filter':_0x27da01}),this[_0x222e('0x26')]['set'](_0x4f7173,{'collection':_0x191c09,'filter':_0x27da01});const _0x11cd83=this['_uis'][_0x222e('0x13')](_0x4f7173);_0x11cd83[_0x222e('0x10')](_0x191c09),this[_0x222e('0x11')](_0x11cd83,_0x222e('0x28'),(_0xda4c12,_0x4f5f75,_0x4e281e,_0x3d9045)=>{_0x3d9045&&_0x2b42a[_0x222e('0x21')](_0x3d9045),_0x4e281e&&_0x2b42a['_addActiveAnnotation'](_0x4e281e);});}['deactivate'](_0x1318c8){if(this['activeUIs'][_0x222e('0x2c')](_0x1318c8),!this[_0x222e('0x1a')][_0x222e('0x20')](_0x1318c8))throw new _0x519c9e(_0x222e('0x22'),this,{'uiName':_0x1318c8});const _0x47484d=this[_0x222e('0x1a')]['get'](_0x1318c8);_0x47484d['detach'](),this[_0x222e('0x7')](_0x47484d),this[_0x222e('0x26')][_0x222e('0x13')](_0x1318c8)[_0x222e('0xc')][_0x222e('0x27')](),this['_uisData']['delete'](_0x1318c8);}['switchTo'](_0x534e78){if(!this[_0x222e('0x1a')][_0x222e('0x20')](_0x534e78))throw new _0x519c9e(_0x222e('0x22'),this,{'uiName':_0x534e78});const _0x47a29c=this[_0x222e('0xf')]['plugins']['get'](_0x5c75f1),_0x47d1e4=Array['from'](_0x47a29c[_0x222e('0x1b')])[0x0]||null;this[_0x222e('0x15')](),this['activate'](_0x534e78);const _0x39f707=this[_0x222e('0x1a')][_0x222e('0x13')](_0x534e78);_0x39f707['setActiveAnnotation'](_0x47d1e4),_0x39f707[_0x222e('0x5')]&&_0x47d1e4&&_0x39f707[_0x222e('0x5')]([_0x47d1e4]);}[_0x222e('0x15')](){for(const _0x39acd6 of this[_0x222e('0x3')])this[_0x222e('0x16')](_0x39acd6);}[_0x222e('0x18')](_0x37f437,_0x15cf1f){if(this[_0x222e('0x1a')][_0x222e('0x20')](_0x37f437))throw new _0x519c9e(_0x222e('0x23'));if(_0x222e('0x8')!=typeof _0x15cf1f[_0x222e('0x10')]||'function'!=typeof _0x15cf1f[_0x222e('0x1c')]||_0x222e('0x8')!=typeof _0x15cf1f[_0x222e('0x1e')])throw new _0x519c9e('annotationsuis-register-invalid-interface',null);this[_0x222e('0x1a')][_0x222e('0x1f')](_0x37f437,_0x15cf1f);}[_0x222e('0xb')](){const _0x49baaa=this[_0x222e('0xf')]['plugins']['get'](_0x5c75f1)[_0x222e('0xc')],_0x5a92ae=new Map(),_0x3a505f=Array[_0x222e('0x19')](this[_0x222e('0x3')]);for(const _0x534575 of this[_0x222e('0x3')]){const _0x1d615f=this[_0x222e('0x26')][_0x222e('0x13')](_0x534575)[_0x222e('0xc')];for(const _0x522227 of _0x1d615f)_0x5a92ae[_0x222e('0x1f')](_0x522227,_0x534575);}for(const _0x85fcf6 of _0x49baaa){const _0x30e0f8=_0x5a92ae[_0x222e('0x13')](_0x85fcf6);this[_0x222e('0x4')](_0x85fcf6);const _0x4822e2=_0x3a505f[_0x222e('0xe')](_0x56dbe7=>this[_0x222e('0x26')][_0x222e('0x13')](_0x56dbe7)['filter'](_0x85fcf6));_0x30e0f8!==_0x4822e2&&(_0x30e0f8&&this[_0x222e('0x26')][_0x222e('0x13')](_0x30e0f8)[_0x222e('0xc')][_0x222e('0x29')](_0x85fcf6),_0x4822e2&&this[_0x222e('0x26')]['get'](_0x4822e2)['collection'][_0x222e('0x17')](_0x85fcf6));}}[_0x222e('0x27')](){this[_0x222e('0x15')](),super[_0x222e('0x27')]();}[_0x222e('0x4')](_0x183ea5){const _0x170f4d=[];for(const _0x49a39e of this[_0x222e('0x3')]){(0x0,this[_0x222e('0x26')]['get'](_0x49a39e)['filter'])(_0x183ea5)&&_0x170f4d[_0x222e('0xa')](_0x49a39e);}if(_0x170f4d[_0x222e('0x14')]>0x1)throw new _0x519c9e('annotationsuis-annotation-mismatch',null,{'matchedUIs':_0x170f4d,'annotationType':_0x183ea5[_0x222e('0x2')]});}}
23
+ const _0x4fec=['add','context','_removeActiveAnnotation','listenTo','has','_activateAnnotation','length','switchTo','filter','annotationsuis-missing-ui','plugins','init','activate','push','size','setActiveAnnotation','requires','hasActive','_assertAnnotationDoesNotBelongToMultipleUIs','refilterAnnotations','attach','isActive','remove','destroy','annotationsuis-register-invalid-interface','register','change:activeAnnotation','_addActiveAnnotation','pluginName','set','annotationsuis-annotation-mismatch','_deactivateAllAnnotations','function','_uisData','AnnotationsUIs','_setSelectedAnnotations','activeAnnotations','type','_visibleAnnotations','get','delete','stopListening','activeUIs','collection','_uis','detach','deactivateAll','from','deactivate'];(function(_0x1f9613,_0x4fece1){const _0x4fb494=function(_0x490230){while(--_0x490230){_0x1f9613['push'](_0x1f9613['shift']());}};_0x4fb494(++_0x4fece1);}(_0x4fec,0xe8));const _0x4fb4=function(_0x1f9613,_0x4fece1){_0x1f9613=_0x1f9613-0x0;let _0x4fb494=_0x4fec[_0x1f9613];return _0x4fb494;};import{ContextPlugin as _0x18fe70}from'ckeditor5/src/core';import{CKEditorError as _0x105095}from'ckeditor5/src/utils';import _0xf65751,{bindAnnotationCollections as _0x163537}from'./annotationcollection';import _0x377632 from'./annotations';export default class M extends _0x18fe70{static get[_0x4fb4('0x1d')](){return[_0x377632];}static get[_0x4fb4('0x29')](){return _0x4fb4('0x2f');}constructor(_0x556b35){super(_0x556b35),this[_0x4fb4('0x6')]=new Set(),this[_0x4fb4('0x8')]=new Map(),this[_0x4fb4('0x2e')]=new Map();}[_0x4fb4('0x18')](){const _0x168c72=this['context'][_0x4fb4('0x17')]['get'](_0x377632);this[_0x4fb4('0x10')](_0x168c72,_0x4fb4('0x12'),(_0x1fce01,_0xf1c841)=>{for(const _0x1c6f6e of this['activeUIs']){const _0x541eb6=this[_0x4fb4('0x8')]['get'](_0x1c6f6e);(0x0,this[_0x4fb4('0x2e')][_0x4fb4('0x3')](_0x1c6f6e)[_0x4fb4('0x15')])(_0xf1c841)&&_0x541eb6['setActiveAnnotation'](_0xf1c841);}}),this[_0x4fb4('0x10')](_0x168c72,_0x4fb4('0x2c'),()=>{for(const _0x209a2b of this[_0x4fb4('0x6')]){this['_uis'][_0x4fb4('0x3')](_0x209a2b)[_0x4fb4('0x1c')](null);}}),this[_0x4fb4('0x10')](_0x168c72[_0x4fb4('0x2')],_0x4fb4('0xd'),(_0x35ff2b,_0x5e1c83)=>{this[_0x4fb4('0x1f')](_0x5e1c83);});}[_0x4fb4('0x1e')](){return this[_0x4fb4('0x6')][_0x4fb4('0x1b')]>0x0;}[_0x4fb4('0x22')](_0x36aba8){return this[_0x4fb4('0x6')][_0x4fb4('0x11')](_0x36aba8);}[_0x4fb4('0x19')](_0x29f44a,_0xc743aa=()=>!0x0){const _0x671386=this[_0x4fb4('0xe')][_0x4fb4('0x17')][_0x4fb4('0x3')](_0x377632);if(!this[_0x4fb4('0x8')][_0x4fb4('0x11')](_0x29f44a))throw new _0x105095(_0x4fb4('0x16'),this,{'uiName':_0x29f44a});this['isActive'](_0x29f44a)&&this[_0x4fb4('0xc')](_0x29f44a),this[_0x4fb4('0x6')][_0x4fb4('0xd')](_0x29f44a);const _0x45ee0d=new _0xf65751(),_0x4f5bec=_0x671386[_0x4fb4('0x2')];_0x163537({'source':_0x4f5bec,'target':_0x45ee0d,'filter':_0xc743aa}),this[_0x4fb4('0x2e')][_0x4fb4('0x2a')](_0x29f44a,{'collection':_0x45ee0d,'filter':_0xc743aa});const _0x121a34=this[_0x4fb4('0x8')][_0x4fb4('0x3')](_0x29f44a);_0x121a34[_0x4fb4('0x21')](_0x45ee0d),this['listenTo'](_0x121a34,_0x4fb4('0x27'),(_0x2609ca,_0x29447e,_0x444313,_0x4775bb)=>{_0x4775bb&&_0x671386[_0x4fb4('0xf')](_0x4775bb),_0x444313&&_0x671386[_0x4fb4('0x28')](_0x444313);});}[_0x4fb4('0xc')](_0x115807){if(this[_0x4fb4('0x6')][_0x4fb4('0x4')](_0x115807),!this[_0x4fb4('0x8')][_0x4fb4('0x11')](_0x115807))throw new _0x105095('annotationsuis-missing-ui',this,{'uiName':_0x115807});const _0x3d5651=this[_0x4fb4('0x8')][_0x4fb4('0x3')](_0x115807);_0x3d5651['detach'](),this[_0x4fb4('0x5')](_0x3d5651),this['_uisData'][_0x4fb4('0x3')](_0x115807)[_0x4fb4('0x7')][_0x4fb4('0x24')](),this[_0x4fb4('0x2e')]['delete'](_0x115807);}[_0x4fb4('0x14')](_0x465745){if(!this['_uis'][_0x4fb4('0x11')](_0x465745))throw new _0x105095(_0x4fb4('0x16'),this,{'uiName':_0x465745});const _0x10bde0=this[_0x4fb4('0xe')][_0x4fb4('0x17')]['get'](_0x377632),_0x1e8c9e=Array['from'](_0x10bde0[_0x4fb4('0x0')])[0x0]||null;this[_0x4fb4('0xa')](),this[_0x4fb4('0x19')](_0x465745);const _0xf20f4b=this[_0x4fb4('0x8')][_0x4fb4('0x3')](_0x465745);_0xf20f4b[_0x4fb4('0x1c')](_0x1e8c9e),_0xf20f4b[_0x4fb4('0x30')]&&_0x1e8c9e&&_0xf20f4b['_setSelectedAnnotations']([_0x1e8c9e]);}[_0x4fb4('0xa')](){for(const _0x435759 of this[_0x4fb4('0x6')])this[_0x4fb4('0xc')](_0x435759);}[_0x4fb4('0x26')](_0x561730,_0x4ea4a4){if(this[_0x4fb4('0x8')][_0x4fb4('0x11')](_0x561730))throw new _0x105095('annotationsuis-register-already-registered');if(_0x4fb4('0x2d')!=typeof _0x4ea4a4[_0x4fb4('0x21')]||_0x4fb4('0x2d')!=typeof _0x4ea4a4[_0x4fb4('0x9')]||_0x4fb4('0x2d')!=typeof _0x4ea4a4[_0x4fb4('0x1c')])throw new _0x105095(_0x4fb4('0x25'),null);this[_0x4fb4('0x8')][_0x4fb4('0x2a')](_0x561730,_0x4ea4a4);}[_0x4fb4('0x20')](){const _0x128ea1=this[_0x4fb4('0xe')][_0x4fb4('0x17')][_0x4fb4('0x3')](_0x377632)[_0x4fb4('0x7')],_0x5ad5e3=new Map(),_0x51d9db=Array[_0x4fb4('0xb')](this['activeUIs']);for(const _0x2be9f0 of this[_0x4fb4('0x6')]){const _0x342344=this[_0x4fb4('0x2e')][_0x4fb4('0x3')](_0x2be9f0)[_0x4fb4('0x7')];for(const _0x5153c5 of _0x342344)_0x5ad5e3[_0x4fb4('0x2a')](_0x5153c5,_0x2be9f0);}for(const _0x340beb of _0x128ea1){const _0x23395e=_0x5ad5e3[_0x4fb4('0x3')](_0x340beb);this['_assertAnnotationDoesNotBelongToMultipleUIs'](_0x340beb);const _0x5136ff=_0x51d9db['find'](_0x245be7=>this[_0x4fb4('0x2e')][_0x4fb4('0x3')](_0x245be7)['filter'](_0x340beb));_0x23395e!==_0x5136ff&&(_0x23395e&&this['_uisData']['get'](_0x23395e)[_0x4fb4('0x7')][_0x4fb4('0x23')](_0x340beb),_0x5136ff&&this[_0x4fb4('0x2e')][_0x4fb4('0x3')](_0x5136ff)[_0x4fb4('0x7')][_0x4fb4('0xd')](_0x340beb));}}[_0x4fb4('0x24')](){this[_0x4fb4('0xa')](),super[_0x4fb4('0x24')]();}['_assertAnnotationDoesNotBelongToMultipleUIs'](_0x9467c8){const _0xc2a974=[];for(const _0x31a650 of this[_0x4fb4('0x6')]){(0x0,this[_0x4fb4('0x2e')][_0x4fb4('0x3')](_0x31a650)[_0x4fb4('0x15')])(_0x9467c8)&&_0xc2a974[_0x4fb4('0x1a')](_0x31a650);}if(_0xc2a974[_0x4fb4('0x13')]>0x1)throw new _0x105095(_0x4fb4('0x2b'),null,{'matchedUIs':_0xc2a974,'annotationType':_0x9467c8[_0x4fb4('0x1')]});}}