@ckeditor/ckeditor5-comments 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 (98) hide show
  1. package/build/comments.js +1 -1
  2. package/build/translations/en-au.js +1 -1
  3. package/build/translations/it.js +1 -1
  4. package/build/translations/lv.js +1 -1
  5. package/build/translations/pt-br.js +1 -1
  6. package/build/translations/sk.js +1 -1
  7. package/build/translations/sq.js +1 -0
  8. package/lang/translations/en-au.po +1 -1
  9. package/lang/translations/it.po +1 -1
  10. package/lang/translations/lv.po +1 -1
  11. package/lang/translations/pt-br.po +1 -1
  12. package/lang/translations/sk.po +1 -1
  13. package/lang/translations/sq.po +111 -0
  14. package/package.json +10 -8
  15. package/src/annotations/annotation.d.ts +86 -86
  16. package/src/annotations/annotation.js +1 -1
  17. package/src/annotations/annotationcollection.d.ts +94 -94
  18. package/src/annotations/annotationcollection.js +1 -1
  19. package/src/annotations/annotations.d.ts +150 -150
  20. package/src/annotations/annotations.js +1 -1
  21. package/src/annotations/annotationsuis.d.ts +228 -227
  22. package/src/annotations/annotationsuis.js +1 -1
  23. package/src/annotations/editorannotations.d.ts +63 -62
  24. package/src/annotations/editorannotations.js +1 -1
  25. package/src/annotations/inlineannotations.d.ts +86 -84
  26. package/src/annotations/inlineannotations.js +1 -1
  27. package/src/annotations/narrowsidebar.d.ts +81 -80
  28. package/src/annotations/narrowsidebar.js +1 -1
  29. package/src/annotations/sidebar.d.ts +96 -96
  30. package/src/annotations/sidebar.js +1 -1
  31. package/src/annotations/view/annotationcounterbuttonview.d.ts +25 -25
  32. package/src/annotations/view/annotationcounterbuttonview.js +1 -1
  33. package/src/annotations/view/annotationview.d.ts +86 -86
  34. package/src/annotations/view/annotationview.js +1 -1
  35. package/src/annotations/view/sidebaritemview.d.ts +51 -51
  36. package/src/annotations/view/sidebaritemview.js +1 -1
  37. package/src/annotations/view/sidebarview.d.ts +28 -28
  38. package/src/annotations/view/sidebarview.js +1 -1
  39. package/src/annotations/widesidebar.d.ts +73 -72
  40. package/src/annotations/widesidebar.js +1 -1
  41. package/src/augmentation.d.ts +48 -48
  42. package/src/comments/addcommentthreadcommand.d.ts +31 -31
  43. package/src/comments/addcommentthreadcommand.js +1 -1
  44. package/src/comments/commentsarchive.d.ts +27 -25
  45. package/src/comments/commentsarchive.js +1 -1
  46. package/src/comments/commentsarchiveui.d.ts +34 -32
  47. package/src/comments/commentsarchiveui.js +1 -1
  48. package/src/comments/commentsediting.d.ts +75 -71
  49. package/src/comments/commentsediting.js +1 -1
  50. package/src/comments/commentsrepository.d.ts +1088 -1084
  51. package/src/comments/commentsrepository.js +1 -1
  52. package/src/comments/commentsui.d.ts +29 -25
  53. package/src/comments/commentsui.js +1 -1
  54. package/src/comments/integrations/commentsrestrictededitingmode.d.ts +13 -13
  55. package/src/comments/integrations/commentsrestrictededitingmode.js +1 -1
  56. package/src/comments/integrations/importword.d.ts +17 -17
  57. package/src/comments/integrations/importword.js +1 -1
  58. package/src/comments/ui/commenteditor/commenteditor.d.ts +32 -32
  59. package/src/comments/ui/commenteditor/commenteditor.js +1 -1
  60. package/src/comments/ui/commenteditor/commenteditorui.d.ts +27 -27
  61. package/src/comments/ui/commenteditor/commenteditorui.js +1 -1
  62. package/src/comments/ui/commenteditor/commenteditoruiview.d.ts +32 -32
  63. package/src/comments/ui/commenteditor/commenteditoruiview.js +1 -1
  64. package/src/comments/ui/commentthreadcontroller.d.ts +64 -64
  65. package/src/comments/ui/commentthreadcontroller.js +1 -1
  66. package/src/comments/ui/view/basecommentthreadview.d.ts +108 -108
  67. package/src/comments/ui/view/basecommentthreadview.js +1 -1
  68. package/src/comments/ui/view/basecommentview.d.ts +108 -108
  69. package/src/comments/ui/view/basecommentview.js +1 -1
  70. package/src/comments/ui/view/collapsedcommentsview.d.ts +9 -9
  71. package/src/comments/ui/view/collapsedcommentsview.js +1 -1
  72. package/src/comments/ui/view/commentcontentview.d.ts +10 -10
  73. package/src/comments/ui/view/commentcontentview.js +1 -1
  74. package/src/comments/ui/view/commentinputview.d.ts +82 -82
  75. package/src/comments/ui/view/commentinputview.js +1 -1
  76. package/src/comments/ui/view/commentsarchiveview.d.ts +34 -34
  77. package/src/comments/ui/view/commentsarchiveview.js +1 -1
  78. package/src/comments/ui/view/commentslistview.d.ts +96 -96
  79. package/src/comments/ui/view/commentslistview.js +1 -1
  80. package/src/comments/ui/view/commentthreadheaderview.d.ts +46 -46
  81. package/src/comments/ui/view/commentthreadheaderview.js +1 -1
  82. package/src/comments/ui/view/commentthreadinputview.d.ts +37 -37
  83. package/src/comments/ui/view/commentthreadinputview.js +1 -1
  84. package/src/comments/ui/view/commentthreadview.d.ts +113 -113
  85. package/src/comments/ui/view/commentthreadview.js +1 -1
  86. package/src/comments/ui/view/commentview.d.ts +239 -239
  87. package/src/comments/ui/view/commentview.js +1 -1
  88. package/src/comments.d.ts +31 -22
  89. package/src/comments.js +1 -1
  90. package/src/commentsonly.d.ts +29 -28
  91. package/src/commentsonly.js +1 -1
  92. package/src/config.d.ts +172 -172
  93. package/src/index.d.ts +21 -19
  94. package/src/index.js +1 -1
  95. package/src/utils/common-translations.d.ts +5 -5
  96. package/src/utils/common-translations.js +1 -1
  97. package/src/utils/createmutationobserver.d.ts +13 -13
  98. package/src/utils/createmutationobserver.js +1 -1
@@ -1,227 +1,228 @@
1
- /**
2
- * @module comments/annotations/annotationsuis
3
- * @publicApi
4
- */
5
- import { ContextPlugin, type Plugin, type PluginDependencies, type Editor, type Context } from 'ckeditor5/src/core';
6
- import { type Emitter } from 'ckeditor5/src/utils';
7
- import AnnotationCollection from './annotationcollection';
8
- import type Annotation from './annotation';
9
- /**
10
- * A repository of annotations UIs.
11
- *
12
- * The main entry point for {@link module:comments/annotations/annotationsuis~AnnotationsUIs#register registering} UIs
13
- * and activating the annotations UI(s), which display annotation views.
14
- *
15
- * To register a custom annotations UI use following code in the annotations UI plugin `init()` function:
16
- *
17
- * ```ts
18
- * const annotationsUIs = editor.plugins.get( 'annotationsUIs' );
19
- *
20
- * annotationsUIs.register( customAnnotationsUIPlugin );
21
- * ```
22
- *
23
- * Note that the custom annotations UI must implement {@link module:comments/annotations/annotationsuis~AnnotationsUI
24
- * the `AnnotationsUI` interface}.
25
- *
26
- * To activate an annotations UI, use the {@link module:comments/annotations/annotationsuis~AnnotationsUIs#switchTo
27
- * `switchTo( uiName )`} method. This method activates the given UI and deactivates all the other UIs.
28
- * All annotations will be handled by the activated UI.
29
- *
30
- * It is also possible to activate multiple annotations UIs at the same time and make the UIs handle different sets of annotations.
31
- * To do that, use the {@link module:comments/annotations/annotationsuis~AnnotationsUIs#activate `activate( uiName, filter )`} method.
32
- *
33
- * ```ts
34
- * // Suggestions annotations are shown inline in a balloon:
35
- * annotationsUIs.activate( 'inline', annotation => annotation.type.startsWith( 'suggestion' ) );
36
- *
37
- * // At the same time, comments annotations are shown in a sidebar:
38
- * annotationsUIs.activate( 'wideSidebar', annotation => annotation.type === 'comment' );
39
- * ```
40
- *
41
- * Limitations:
42
- *
43
- * * Some annotations UI plugins might collide with each other (like {@link module:comments/annotations/narrowsidebar~NarrowSidebar} and
44
- * {@link module:comments/annotations/widesidebar~WideSidebar} that operates on the same sidebar). They cannot be activated at the same
45
- * time.
46
- * * It is not possible to display the same annotation in two different annotations UIs. In this scenario an error will be thrown.
47
- */
48
- export default class AnnotationsUIs extends ContextPlugin {
49
- /**
50
- * A set of names of the active annotations UIs.
51
- *
52
- * To activate the annotations UI, use {@link module:comments/annotations/annotationsuis~AnnotationsUIs#activate}
53
- * or {@link #switchTo} methods.
54
- */
55
- activeUIs: Set<string>;
56
- /**
57
- * @inheritDoc
58
- */
59
- static get requires(): PluginDependencies<Context | Editor>;
60
- /**
61
- * @inheritDoc
62
- */
63
- static get pluginName(): 'AnnotationsUIs';
64
- /**
65
- * @inheritDoc
66
- */
67
- constructor(context: Context | Editor);
68
- /**
69
- * @inheritDoc
70
- */
71
- init(): void;
72
- /**
73
- * Returns `true` if at least one registered UI is active.
74
- */
75
- hasActive(): boolean;
76
- /**
77
- * Returns `true` if the given UI is active.
78
- */
79
- isActive(uiName: string): boolean;
80
- /**
81
- * Activates an annotations UI.
82
- *
83
- * Note that the custom annotations UI should be {@link #register registered} before the activation.
84
- *
85
- * The `filter` parameter can be used to display on some of the annotations in the given annotations UI. Thanks to that,
86
- * all annotations can be split into various annotations UIs.
87
- *
88
- * The `filter` function takes an {@link module:comments/annotations/annotation~Annotation} instance as the first and only parameter,
89
- * and should return `true` if that annotation should be placed in the given annotations UI.
90
- *
91
- * @param uiName The name of the annotations UI to activate.
92
- * @param filter The annotation filter function. If not specified, the UI will use all annotations.
93
- */
94
- activate(uiName: string, filter?: () => boolean): void;
95
- /**
96
- * Deactivates annotations UI with given name.
97
- *
98
- * @param uiName The name of the annotations UI to deactivate.
99
- */
100
- deactivate(uiName: string): void;
101
- /**
102
- * Switches the annotations UI to the one with given name.
103
- *
104
- * It preserves the currently active annotation.
105
- *
106
- * @param uiName The name of the annotations UI to switch to.
107
- */
108
- switchTo(uiName: string): void;
109
- /**
110
- * Deactivates all annotations UIs.
111
- */
112
- deactivateAll(): void;
113
- /**
114
- * Registers an annotations UI. It might be one of:
115
- *
116
- * * {@link module:comments/annotations/widesidebar~WideSidebar},
117
- * * {@link module:comments/annotations/narrowsidebar~NarrowSidebar},
118
- * * {@link module:comments/annotations/inlineannotations~InlineAnnotations}.
119
- *
120
- * It is possible to provide your own, custom annotations UI plugin. It has to implement
121
- * {@link module:comments/annotations/annotationsuis~AnnotationsUI the `AnnotationsUI` interface}.
122
- *
123
- * @param uiName Annotations UI name.
124
- * @param annotationsUI Annotations UI plugin instance.
125
- */
126
- register(uiName: string, annotationsUI: AnnotationsUI<ContextPlugin | Plugin>): void;
127
- /**
128
- * Refilters annotations to proper UIs based on filters provided earlier during the
129
- * {@link module:comments/annotations/annotationsuis~AnnotationsUIs#activate annotations UIs activation}.
130
- *
131
- * This method should be used if the annotations UIs filtering functions return different results than before
132
- * for some annotations. It only reattaches these annotations, which should change their UIs.
133
- */
134
- refilterAnnotations(): void;
135
- /**
136
- * @inheritDoc
137
- */
138
- destroy(): void;
139
- }
140
- /**
141
- * An interface for the annotations UI plugin class.
142
- *
143
- * The annotations UI class handles displaying, focusing, activating and hiding annotations views.
144
- *
145
- * The annotations UI class must be a plugin, so it has to extend the {@link module:core/plugin~Plugin} or
146
- * {@link module:core/contextplugin~ContextPlugin} class.
147
- *
148
- * Examples of `AnnotationsUI` are:
149
- *
150
- * * {@link module:comments/annotations/widesidebar~WideSidebar},
151
- * * {@link module:comments/annotations/narrowsidebar~NarrowSidebar},
152
- * * {@link module:comments/annotations/inlineannotations~InlineAnnotations}.
153
- *
154
- * You can use the following snippet as a base for your own annotations UI:
155
- *
156
- * ```ts
157
- * class MyAnnotationsUI extends ContextPlugin {
158
- * constructor( ...args ) {
159
- * super( ...args );
160
- *
161
- * this.set( 'activeAnnotation', null );
162
- * }
163
- *
164
- * attach( annotations ) {
165
- * // Do something when an annotation is added.
166
- * this.listenTo( annotations, 'add', ( evt, annotation ) => { ... } );
167
- *
168
- * // Do something when an annotation is removed.
169
- * this.listenTo( annotations, 'remove', ( evt, annotation ) => { ... } );
170
- * }
171
- *
172
- * detach() {
173
- * this.stopListening();
174
- * }
175
- *
176
- * setActiveAnnotation( annotation ) {
177
- * if ( this.activeAnnotation ) {
178
- * this.activeAnnotation.isActive = false;
179
- *
180
- * // You can do something in your UI with the annotation that is no longer active.
181
- * }
182
- *
183
- * this.activeAnnotation = annotation;
184
- * this.activeAnnotation.isActive = true;
185
- *
186
- * // You can do something in your UI to highlight the active annotation.
187
- * }
188
- * }
189
- * ```
190
- */
191
- export interface AnnotationUI {
192
- /**
193
- * Observable `activeAnnotation` property. {@link module:comments/annotations/annotationsuis~AnnotationsUIs} listens to changes on that
194
- * property.
195
- *
196
- * To make this property observable use `this.set( 'activeAnnotation', null )` in the constructor.
197
- */
198
- activeAnnotation: Annotation | null;
199
- /**
200
- * Creates everything needed for the UI and attaches all listeners. This method is called when the UI is activated.
201
- *
202
- * The observable collection of annotations is passed as the first argument,
203
- * and the annotations UI is responsible for reacting to its changes.
204
- */
205
- attach: (annotationCollection: AnnotationCollection) => void;
206
- /**
207
- * Destroys the UI and removes all listeners. This method is called when the UI is deactivated.
208
- */
209
- detach: () => void;
210
- /**
211
- * Sets or unsets the active annotation. This method is called when an annotation is activated, for example, user puts their
212
- * selection into a marker connected with given annotation.
213
- *
214
- * This method should change the UI so the new active annotation is differentiated from other annotations.
215
- *
216
- * This method should set the
217
- * {@link #activeAnnotation `AnnotationUI#activeAnnotation`} property.
218
- *
219
- * It also should set {@link module:comments/annotations/annotation~Annotation#isActive `Annotation#isActive`} of the deactivated
220
- * and the activated annotation.
221
- *
222
- * @param annotation The new active annotation or null when no annotation is active.
223
- */
224
- setActiveAnnotation: (annotation: Annotation | null) => void;
225
- _setSelectedAnnotations?: (annotations: Array<Annotation>) => void;
226
- }
227
- export type AnnotationsUI<T extends Emitter> = T & AnnotationUI;
1
+ /**
2
+ * @module comments/annotations/annotationsuis
3
+ * @publicApi
4
+ */
5
+ import { ContextPlugin, type Plugin, type Editor, type Context } from 'ckeditor5/src/core';
6
+ import { type Emitter } from 'ckeditor5/src/utils';
7
+ import AnnotationCollection from './annotationcollection';
8
+ import Annotations from './annotations';
9
+ import type Annotation from './annotation';
10
+ /**
11
+ * A repository of annotations UIs.
12
+ *
13
+ * The main entry point for {@link module:comments/annotations/annotationsuis~AnnotationsUIs#register registering} UIs
14
+ * and activating the annotations UI(s), which display annotation views.
15
+ *
16
+ * To register a custom annotations UI use following code in the annotations UI plugin `init()` function:
17
+ *
18
+ * ```ts
19
+ * const annotationsUIs = editor.plugins.get( 'annotationsUIs' );
20
+ *
21
+ * annotationsUIs.register( customAnnotationsUIPlugin );
22
+ * ```
23
+ *
24
+ * Note that the custom annotations UI must implement {@link module:comments/annotations/annotationsuis~AnnotationsUI
25
+ * the `AnnotationsUI` interface}.
26
+ *
27
+ * To activate an annotations UI, use the {@link module:comments/annotations/annotationsuis~AnnotationsUIs#switchTo
28
+ * `switchTo( uiName )`} method. This method activates the given UI and deactivates all the other UIs.
29
+ * All annotations will be handled by the activated UI.
30
+ *
31
+ * It is also possible to activate multiple annotations UIs at the same time and make the UIs handle different sets of annotations.
32
+ * To do that, use the {@link module:comments/annotations/annotationsuis~AnnotationsUIs#activate `activate( uiName, filter )`} method.
33
+ *
34
+ * ```ts
35
+ * // Suggestions annotations are shown inline in a balloon:
36
+ * annotationsUIs.activate( 'inline', annotation => annotation.type.startsWith( 'suggestion' ) );
37
+ *
38
+ * // At the same time, comments annotations are shown in a sidebar:
39
+ * annotationsUIs.activate( 'wideSidebar', annotation => annotation.type === 'comment' );
40
+ * ```
41
+ *
42
+ * Limitations:
43
+ *
44
+ * * Some annotations UI plugins might collide with each other (like {@link module:comments/annotations/narrowsidebar~NarrowSidebar} and
45
+ * {@link module:comments/annotations/widesidebar~WideSidebar} that operates on the same sidebar). They cannot be activated at the same
46
+ * time.
47
+ * * It is not possible to display the same annotation in two different annotations UIs. In this scenario an error will be thrown.
48
+ */
49
+ export default class AnnotationsUIs extends ContextPlugin {
50
+ /**
51
+ * A set of names of the active annotations UIs.
52
+ *
53
+ * To activate the annotations UI, use {@link module:comments/annotations/annotationsuis~AnnotationsUIs#activate}
54
+ * or {@link #switchTo} methods.
55
+ */
56
+ activeUIs: Set<string>;
57
+ /**
58
+ * @inheritDoc
59
+ */
60
+ static get requires(): readonly [typeof Annotations];
61
+ /**
62
+ * @inheritDoc
63
+ */
64
+ static get pluginName(): "AnnotationsUIs";
65
+ /**
66
+ * @inheritDoc
67
+ */
68
+ constructor(context: Context | Editor);
69
+ /**
70
+ * @inheritDoc
71
+ */
72
+ init(): void;
73
+ /**
74
+ * Returns `true` if at least one registered UI is active.
75
+ */
76
+ hasActive(): boolean;
77
+ /**
78
+ * Returns `true` if the given UI is active.
79
+ */
80
+ isActive(uiName: string): boolean;
81
+ /**
82
+ * Activates an annotations UI.
83
+ *
84
+ * Note that the custom annotations UI should be {@link #register registered} before the activation.
85
+ *
86
+ * The `filter` parameter can be used to display on some of the annotations in the given annotations UI. Thanks to that,
87
+ * all annotations can be split into various annotations UIs.
88
+ *
89
+ * The `filter` function takes an {@link module:comments/annotations/annotation~Annotation} instance as the first and only parameter,
90
+ * and should return `true` if that annotation should be placed in the given annotations UI.
91
+ *
92
+ * @param uiName The name of the annotations UI to activate.
93
+ * @param filter The annotation filter function. If not specified, the UI will use all annotations.
94
+ */
95
+ activate(uiName: string, filter?: () => boolean): void;
96
+ /**
97
+ * Deactivates annotations UI with given name.
98
+ *
99
+ * @param uiName The name of the annotations UI to deactivate.
100
+ */
101
+ deactivate(uiName: string): void;
102
+ /**
103
+ * Switches the annotations UI to the one with given name.
104
+ *
105
+ * It preserves the currently active annotation.
106
+ *
107
+ * @param uiName The name of the annotations UI to switch to.
108
+ */
109
+ switchTo(uiName: string): void;
110
+ /**
111
+ * Deactivates all annotations UIs.
112
+ */
113
+ deactivateAll(): void;
114
+ /**
115
+ * Registers an annotations UI. It might be one of:
116
+ *
117
+ * * {@link module:comments/annotations/widesidebar~WideSidebar},
118
+ * * {@link module:comments/annotations/narrowsidebar~NarrowSidebar},
119
+ * * {@link module:comments/annotations/inlineannotations~InlineAnnotations}.
120
+ *
121
+ * It is possible to provide your own, custom annotations UI plugin. It has to implement
122
+ * {@link module:comments/annotations/annotationsuis~AnnotationsUI the `AnnotationsUI` interface}.
123
+ *
124
+ * @param uiName Annotations UI name.
125
+ * @param annotationsUI Annotations UI plugin instance.
126
+ */
127
+ register(uiName: string, annotationsUI: AnnotationsUI<ContextPlugin | Plugin>): void;
128
+ /**
129
+ * Refilters annotations to proper UIs based on filters provided earlier during the
130
+ * {@link module:comments/annotations/annotationsuis~AnnotationsUIs#activate annotations UIs activation}.
131
+ *
132
+ * This method should be used if the annotations UIs filtering functions return different results than before
133
+ * for some annotations. It only reattaches these annotations, which should change their UIs.
134
+ */
135
+ refilterAnnotations(): void;
136
+ /**
137
+ * @inheritDoc
138
+ */
139
+ destroy(): void;
140
+ }
141
+ /**
142
+ * An interface for the annotations UI plugin class.
143
+ *
144
+ * The annotations UI class handles displaying, focusing, activating and hiding annotations views.
145
+ *
146
+ * The annotations UI class must be a plugin, so it has to extend the {@link module:core/plugin~Plugin} or
147
+ * {@link module:core/contextplugin~ContextPlugin} class.
148
+ *
149
+ * Examples of `AnnotationsUI` are:
150
+ *
151
+ * * {@link module:comments/annotations/widesidebar~WideSidebar},
152
+ * * {@link module:comments/annotations/narrowsidebar~NarrowSidebar},
153
+ * * {@link module:comments/annotations/inlineannotations~InlineAnnotations}.
154
+ *
155
+ * You can use the following snippet as a base for your own annotations UI:
156
+ *
157
+ * ```ts
158
+ * class MyAnnotationsUI extends ContextPlugin {
159
+ * constructor( ...args ) {
160
+ * super( ...args );
161
+ *
162
+ * this.set( 'activeAnnotation', null );
163
+ * }
164
+ *
165
+ * attach( annotations ) {
166
+ * // Do something when an annotation is added.
167
+ * this.listenTo( annotations, 'add', ( evt, annotation ) => { ... } );
168
+ *
169
+ * // Do something when an annotation is removed.
170
+ * this.listenTo( annotations, 'remove', ( evt, annotation ) => { ... } );
171
+ * }
172
+ *
173
+ * detach() {
174
+ * this.stopListening();
175
+ * }
176
+ *
177
+ * setActiveAnnotation( annotation ) {
178
+ * if ( this.activeAnnotation ) {
179
+ * this.activeAnnotation.isActive = false;
180
+ *
181
+ * // You can do something in your UI with the annotation that is no longer active.
182
+ * }
183
+ *
184
+ * this.activeAnnotation = annotation;
185
+ * this.activeAnnotation.isActive = true;
186
+ *
187
+ * // You can do something in your UI to highlight the active annotation.
188
+ * }
189
+ * }
190
+ * ```
191
+ */
192
+ export interface AnnotationUI {
193
+ /**
194
+ * Observable `activeAnnotation` property. {@link module:comments/annotations/annotationsuis~AnnotationsUIs} listens to changes on that
195
+ * property.
196
+ *
197
+ * To make this property observable use `this.set( 'activeAnnotation', null )` in the constructor.
198
+ */
199
+ activeAnnotation: Annotation | null;
200
+ /**
201
+ * Creates everything needed for the UI and attaches all listeners. This method is called when the UI is activated.
202
+ *
203
+ * The observable collection of annotations is passed as the first argument,
204
+ * and the annotations UI is responsible for reacting to its changes.
205
+ */
206
+ attach: (annotationCollection: AnnotationCollection) => void;
207
+ /**
208
+ * Destroys the UI and removes all listeners. This method is called when the UI is deactivated.
209
+ */
210
+ detach: () => void;
211
+ /**
212
+ * Sets or unsets the active annotation. This method is called when an annotation is activated, for example, user puts their
213
+ * selection into a marker connected with given annotation.
214
+ *
215
+ * This method should change the UI so the new active annotation is differentiated from other annotations.
216
+ *
217
+ * This method should set the
218
+ * {@link #activeAnnotation `AnnotationUI#activeAnnotation`} property.
219
+ *
220
+ * It also should set {@link module:comments/annotations/annotation~Annotation#isActive `Annotation#isActive`} of the deactivated
221
+ * and the activated annotation.
222
+ *
223
+ * @param annotation The new active annotation or null when no annotation is active.
224
+ */
225
+ setActiveAnnotation: (annotation: Annotation | null) => void;
226
+ _setSelectedAnnotations?: (annotations: Array<Annotation>) => void;
227
+ }
228
+ export type AnnotationsUI<T extends Emitter> = T & AnnotationUI;
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x4e97=['size','type','stopListening','remove','pluginName','_setSelectedAnnotations','init','_addActiveAnnotation','_assertAnnotationDoesNotBelongToMultipleUIs','destroy','length','_removeActiveAnnotation','listenTo','_uis','context','activeUIs','collection','hasActive','get','attach','filter','deactivate','activate','isActive','deactivateAll','_uisData','_visibleAnnotations','delete','set','annotationsuis-register-already-registered','find','from','requires','has','add','function','annotationsuis-missing-ui','change:activeAnnotation','setActiveAnnotation','plugins','_activateAnnotation'];(function(_0x427d13,_0x4e9734){const _0x1b35c1=function(_0x3669d2){while(--_0x3669d2){_0x427d13['push'](_0x427d13['shift']());}};_0x1b35c1(++_0x4e9734);}(_0x4e97,0x75));const _0x1b35=function(_0x427d13,_0x4e9734){_0x427d13=_0x427d13-0x0;let _0x1b35c1=_0x4e97[_0x427d13];return _0x1b35c1;};import{ContextPlugin as _0x18c0d2}from'ckeditor5/src/core';import{CKEditorError as _0x450074}from'ckeditor5/src/utils';import _0x16765c,{bindAnnotationCollections as _0x291319}from'./annotationcollection';import _0x426561 from'./annotations';export default class M extends _0x18c0d2{static get[_0x1b35('0x26')](){return[_0x426561];}static get[_0x1b35('0xa')](){return'AnnotationsUIs';}constructor(_0x2691a2){super(_0x2691a2),this[_0x1b35('0x15')]=new Set(),this[_0x1b35('0x13')]=new Map(),this[_0x1b35('0x1f')]=new Map();}[_0x1b35('0xc')](){const _0x2ec387=this['context'][_0x1b35('0x4')][_0x1b35('0x18')](_0x426561);this[_0x1b35('0x12')](_0x2ec387,_0x1b35('0x5'),(_0x211d50,_0x5e49f4)=>{for(const _0x207956 of this[_0x1b35('0x15')]){const _0x22eb11=this['_uis']['get'](_0x207956);(0x0,this['_uisData'][_0x1b35('0x18')](_0x207956)[_0x1b35('0x1a')])(_0x5e49f4)&&_0x22eb11[_0x1b35('0x3')](_0x5e49f4);}}),this['listenTo'](_0x2ec387,'_deactivateAllAnnotations',()=>{for(const _0x3cbff7 of this[_0x1b35('0x15')]){this[_0x1b35('0x13')][_0x1b35('0x18')](_0x3cbff7)[_0x1b35('0x3')](null);}}),this[_0x1b35('0x12')](_0x2ec387[_0x1b35('0x20')],_0x1b35('0x28'),(_0xe49227,_0x12d3c4)=>{this[_0x1b35('0xe')](_0x12d3c4);});}[_0x1b35('0x17')](){return this[_0x1b35('0x15')][_0x1b35('0x6')]>0x0;}[_0x1b35('0x1d')](_0x356df5){return this[_0x1b35('0x15')][_0x1b35('0x27')](_0x356df5);}[_0x1b35('0x1c')](_0x14de3c,_0x570f6a=()=>!0x0){const _0x103b50=this[_0x1b35('0x14')][_0x1b35('0x4')]['get'](_0x426561);if(!this[_0x1b35('0x13')]['has'](_0x14de3c))throw new _0x450074(_0x1b35('0x1'),this,{'uiName':_0x14de3c});this[_0x1b35('0x1d')](_0x14de3c)&&this['deactivate'](_0x14de3c),this[_0x1b35('0x15')][_0x1b35('0x28')](_0x14de3c);const _0x4acb72=new _0x16765c(),_0x4113e3=_0x103b50[_0x1b35('0x20')];_0x291319({'source':_0x4113e3,'target':_0x4acb72,'filter':_0x570f6a}),this['_uisData'][_0x1b35('0x22')](_0x14de3c,{'collection':_0x4acb72,'filter':_0x570f6a});const _0x950aab=this[_0x1b35('0x13')][_0x1b35('0x18')](_0x14de3c);_0x950aab['attach'](_0x4acb72),this['listenTo'](_0x950aab,_0x1b35('0x2'),(_0x44fead,_0x5d2b19,_0xbbaf7f,_0x38e735)=>{_0x38e735&&_0x103b50[_0x1b35('0x11')](_0x38e735),_0xbbaf7f&&_0x103b50[_0x1b35('0xd')](_0xbbaf7f);});}[_0x1b35('0x1b')](_0x23e501){if(this[_0x1b35('0x15')][_0x1b35('0x21')](_0x23e501),!this[_0x1b35('0x13')][_0x1b35('0x27')](_0x23e501))throw new _0x450074('annotationsuis-missing-ui',this,{'uiName':_0x23e501});const _0x3c96a0=this[_0x1b35('0x13')][_0x1b35('0x18')](_0x23e501);_0x3c96a0['detach'](),this[_0x1b35('0x8')](_0x3c96a0),this[_0x1b35('0x1f')][_0x1b35('0x18')](_0x23e501)[_0x1b35('0x16')][_0x1b35('0xf')](),this[_0x1b35('0x1f')][_0x1b35('0x21')](_0x23e501);}['switchTo'](_0xfd968f){if(!this['_uis']['has'](_0xfd968f))throw new _0x450074(_0x1b35('0x1'),this,{'uiName':_0xfd968f});const _0xaf70ba=this['context'][_0x1b35('0x4')][_0x1b35('0x18')](_0x426561),_0x5f0f73=Array[_0x1b35('0x25')](_0xaf70ba['activeAnnotations'])[0x0]||null;this[_0x1b35('0x1e')](),this[_0x1b35('0x1c')](_0xfd968f);const _0xd65824=this['_uis'][_0x1b35('0x18')](_0xfd968f);_0xd65824[_0x1b35('0x3')](_0x5f0f73),_0xd65824[_0x1b35('0xb')]&&_0x5f0f73&&_0xd65824['_setSelectedAnnotations']([_0x5f0f73]);}[_0x1b35('0x1e')](){for(const _0x4ee47e of this[_0x1b35('0x15')])this['deactivate'](_0x4ee47e);}['register'](_0x4c599d,_0x55b00a){if(this['_uis']['has'](_0x4c599d))throw new _0x450074(_0x1b35('0x23'));if('function'!=typeof _0x55b00a[_0x1b35('0x19')]||_0x1b35('0x0')!=typeof _0x55b00a['detach']||_0x1b35('0x0')!=typeof _0x55b00a['setActiveAnnotation'])throw new _0x450074('annotationsuis-register-invalid-interface',null);this[_0x1b35('0x13')][_0x1b35('0x22')](_0x4c599d,_0x55b00a);}['refilterAnnotations'](){const _0x523b8d=this[_0x1b35('0x14')][_0x1b35('0x4')][_0x1b35('0x18')](_0x426561)[_0x1b35('0x16')],_0x27a432=new Map(),_0x2494d9=Array[_0x1b35('0x25')](this[_0x1b35('0x15')]);for(const _0x1909e1 of this[_0x1b35('0x15')]){const _0x26b7b4=this[_0x1b35('0x1f')]['get'](_0x1909e1)['collection'];for(const _0xf8a2ab of _0x26b7b4)_0x27a432[_0x1b35('0x22')](_0xf8a2ab,_0x1909e1);}for(const _0x10366e of _0x523b8d){const _0x2f0f12=_0x27a432[_0x1b35('0x18')](_0x10366e);this[_0x1b35('0xe')](_0x10366e);const _0x530328=_0x2494d9[_0x1b35('0x24')](_0x3f109b=>this['_uisData'][_0x1b35('0x18')](_0x3f109b)[_0x1b35('0x1a')](_0x10366e));_0x2f0f12!==_0x530328&&(_0x2f0f12&&this['_uisData']['get'](_0x2f0f12)[_0x1b35('0x16')][_0x1b35('0x9')](_0x10366e),_0x530328&&this['_uisData'][_0x1b35('0x18')](_0x530328)['collection'][_0x1b35('0x28')](_0x10366e));}}[_0x1b35('0xf')](){this[_0x1b35('0x1e')](),super[_0x1b35('0xf')]();}[_0x1b35('0xe')](_0x377521){const _0x2af917=[];for(const _0x5491d6 of this[_0x1b35('0x15')]){(0x0,this['_uisData'][_0x1b35('0x18')](_0x5491d6)[_0x1b35('0x1a')])(_0x377521)&&_0x2af917['push'](_0x5491d6);}if(_0x2af917[_0x1b35('0x10')]>0x1)throw new _0x450074('annotationsuis-annotation-mismatch',null,{'matchedUIs':_0x2af917,'annotationType':_0x377521[_0x1b35('0x7')]});}}
23
+ const _0x53ea=['add','_setSelectedAnnotations','_deactivateAllAnnotations','_assertAnnotationDoesNotBelongToMultipleUIs','plugins','attach','push','size','get','isActive','_removeActiveAnnotation','length','_activateAnnotation','context','init','detach','_addActiveAnnotation','function','refilterAnnotations','register','activate','_uis','requires','activeUIs','from','type','activeAnnotations','pluginName','change:activeAnnotation','remove','hasActive','deactivate','annotationsuis-register-invalid-interface','listenTo','_visibleAnnotations','annotationsuis-register-already-registered','_uisData','set','deactivateAll','has','annotationsuis-missing-ui','switchTo','collection','delete','setActiveAnnotation','filter','destroy'];(function(_0x5b8bfb,_0x53ea71){const _0x58bae4=function(_0x172615){while(--_0x172615){_0x5b8bfb['push'](_0x5b8bfb['shift']());}};_0x58bae4(++_0x53ea71);}(_0x53ea,0x7c));const _0x58ba=function(_0x5b8bfb,_0x53ea71){_0x5b8bfb=_0x5b8bfb-0x0;let _0x58bae4=_0x53ea[_0x5b8bfb];return _0x58bae4;};import{ContextPlugin as _0x1ab06d}from'ckeditor5/src/core';import{CKEditorError as _0x574855}from'ckeditor5/src/utils';import _0x56f484,{bindAnnotationCollections as _0x5550ff}from'./annotationcollection';import _0x590449 from'./annotations';export default class M extends _0x1ab06d{static get[_0x58ba('0x27')](){return[_0x590449];}static get[_0x58ba('0x2c')](){return'AnnotationsUIs';}constructor(_0x1b3d10){super(_0x1b3d10),this[_0x58ba('0x28')]=new Set(),this[_0x58ba('0x26')]=new Map(),this[_0x58ba('0x6')]=new Map();}[_0x58ba('0x1f')](){const _0x165545=this[_0x58ba('0x1e')]['plugins'][_0x58ba('0x19')](_0x590449);this['listenTo'](_0x165545,_0x58ba('0x1d'),(_0x50997e,_0x407a1b)=>{for(const _0x57e771 of this['activeUIs']){const _0x145fbb=this[_0x58ba('0x26')][_0x58ba('0x19')](_0x57e771);(0x0,this[_0x58ba('0x6')][_0x58ba('0x19')](_0x57e771)[_0x58ba('0xf')])(_0x407a1b)&&_0x145fbb['setActiveAnnotation'](_0x407a1b);}}),this[_0x58ba('0x3')](_0x165545,_0x58ba('0x13'),()=>{for(const _0x3965e8 of this[_0x58ba('0x28')]){this[_0x58ba('0x26')][_0x58ba('0x19')](_0x3965e8)['setActiveAnnotation'](null);}}),this[_0x58ba('0x3')](_0x165545[_0x58ba('0x4')],_0x58ba('0x11'),(_0x1d70bb,_0x3b8015)=>{this['_assertAnnotationDoesNotBelongToMultipleUIs'](_0x3b8015);});}[_0x58ba('0x0')](){return this['activeUIs'][_0x58ba('0x18')]>0x0;}[_0x58ba('0x1a')](_0x413b17){return this[_0x58ba('0x28')]['has'](_0x413b17);}['activate'](_0x1f3ad5,_0x1f8012=()=>!0x0){const _0x514838=this[_0x58ba('0x1e')][_0x58ba('0x15')]['get'](_0x590449);if(!this[_0x58ba('0x26')][_0x58ba('0x9')](_0x1f3ad5))throw new _0x574855(_0x58ba('0xa'),this,{'uiName':_0x1f3ad5});this[_0x58ba('0x1a')](_0x1f3ad5)&&this[_0x58ba('0x1')](_0x1f3ad5),this[_0x58ba('0x28')][_0x58ba('0x11')](_0x1f3ad5);const _0x1ba01b=new _0x56f484(),_0x285872=_0x514838[_0x58ba('0x4')];_0x5550ff({'source':_0x285872,'target':_0x1ba01b,'filter':_0x1f8012}),this[_0x58ba('0x6')]['set'](_0x1f3ad5,{'collection':_0x1ba01b,'filter':_0x1f8012});const _0x9a295d=this[_0x58ba('0x26')][_0x58ba('0x19')](_0x1f3ad5);_0x9a295d[_0x58ba('0x16')](_0x1ba01b),this[_0x58ba('0x3')](_0x9a295d,_0x58ba('0x2d'),(_0x41d99d,_0x1e3490,_0x29d95a,_0x255336)=>{_0x255336&&_0x514838[_0x58ba('0x1b')](_0x255336),_0x29d95a&&_0x514838[_0x58ba('0x21')](_0x29d95a);});}[_0x58ba('0x1')](_0xf54d9a){if(this[_0x58ba('0x28')][_0x58ba('0xd')](_0xf54d9a),!this[_0x58ba('0x26')]['has'](_0xf54d9a))throw new _0x574855(_0x58ba('0xa'),this,{'uiName':_0xf54d9a});const _0x2cc55b=this[_0x58ba('0x26')]['get'](_0xf54d9a);_0x2cc55b[_0x58ba('0x20')](),this['stopListening'](_0x2cc55b),this['_uisData'][_0x58ba('0x19')](_0xf54d9a)['collection'][_0x58ba('0x10')](),this[_0x58ba('0x6')]['delete'](_0xf54d9a);}[_0x58ba('0xb')](_0x3dc640){if(!this[_0x58ba('0x26')][_0x58ba('0x9')](_0x3dc640))throw new _0x574855(_0x58ba('0xa'),this,{'uiName':_0x3dc640});const _0x929b18=this[_0x58ba('0x1e')][_0x58ba('0x15')][_0x58ba('0x19')](_0x590449),_0x2a8df3=Array[_0x58ba('0x29')](_0x929b18[_0x58ba('0x2b')])[0x0]||null;this[_0x58ba('0x8')](),this[_0x58ba('0x25')](_0x3dc640);const _0x4dcfc8=this[_0x58ba('0x26')][_0x58ba('0x19')](_0x3dc640);_0x4dcfc8[_0x58ba('0xe')](_0x2a8df3),_0x4dcfc8['_setSelectedAnnotations']&&_0x2a8df3&&_0x4dcfc8[_0x58ba('0x12')]([_0x2a8df3]);}[_0x58ba('0x8')](){for(const _0x4db2fd of this[_0x58ba('0x28')])this['deactivate'](_0x4db2fd);}[_0x58ba('0x24')](_0x335872,_0x2026e0){if(this[_0x58ba('0x26')][_0x58ba('0x9')](_0x335872))throw new _0x574855(_0x58ba('0x5'));if(_0x58ba('0x22')!=typeof _0x2026e0[_0x58ba('0x16')]||_0x58ba('0x22')!=typeof _0x2026e0[_0x58ba('0x20')]||'function'!=typeof _0x2026e0[_0x58ba('0xe')])throw new _0x574855(_0x58ba('0x2'),null);this['_uis'][_0x58ba('0x7')](_0x335872,_0x2026e0);}[_0x58ba('0x23')](){const _0x58cea2=this[_0x58ba('0x1e')][_0x58ba('0x15')]['get'](_0x590449)[_0x58ba('0xc')],_0x289216=new Map(),_0x28f470=Array[_0x58ba('0x29')](this[_0x58ba('0x28')]);for(const _0x5d4385 of this[_0x58ba('0x28')]){const _0x1ce1e7=this[_0x58ba('0x6')]['get'](_0x5d4385)[_0x58ba('0xc')];for(const _0x148ce4 of _0x1ce1e7)_0x289216[_0x58ba('0x7')](_0x148ce4,_0x5d4385);}for(const _0x33baa9 of _0x58cea2){const _0xeb9e82=_0x289216[_0x58ba('0x19')](_0x33baa9);this['_assertAnnotationDoesNotBelongToMultipleUIs'](_0x33baa9);const _0x53ebc7=_0x28f470['find'](_0x3ce9c6=>this['_uisData'][_0x58ba('0x19')](_0x3ce9c6)[_0x58ba('0xf')](_0x33baa9));_0xeb9e82!==_0x53ebc7&&(_0xeb9e82&&this[_0x58ba('0x6')][_0x58ba('0x19')](_0xeb9e82)[_0x58ba('0xc')][_0x58ba('0x2e')](_0x33baa9),_0x53ebc7&&this[_0x58ba('0x6')]['get'](_0x53ebc7)[_0x58ba('0xc')][_0x58ba('0x11')](_0x33baa9));}}[_0x58ba('0x10')](){this['deactivateAll'](),super[_0x58ba('0x10')]();}[_0x58ba('0x14')](_0x37e225){const _0x3378b8=[];for(const _0xc26851 of this['activeUIs']){(0x0,this['_uisData']['get'](_0xc26851)[_0x58ba('0xf')])(_0x37e225)&&_0x3378b8[_0x58ba('0x17')](_0xc26851);}if(_0x3378b8[_0x58ba('0x1c')]>0x1)throw new _0x574855('annotationsuis-annotation-mismatch',null,{'matchedUIs':_0x3378b8,'annotationType':_0x37e225[_0x58ba('0x2a')]});}}