@ckeditor/ckeditor5-comments 39.0.2 → 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 (102) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +1 -1
  3. package/build/comments.js +1 -1
  4. package/build/translations/pt-br.js +1 -1
  5. package/lang/translations/pt-br.po +3 -3
  6. package/package.json +3 -3
  7. package/src/annotations/annotation.d.ts +90 -90
  8. package/src/annotations/annotation.js +1 -1
  9. package/src/annotations/annotationcollection.d.ts +98 -98
  10. package/src/annotations/annotationcollection.js +1 -1
  11. package/src/annotations/annotations.d.ts +154 -154
  12. package/src/annotations/annotations.js +1 -1
  13. package/src/annotations/annotationsuis.d.ts +232 -232
  14. package/src/annotations/annotationsuis.js +1 -1
  15. package/src/annotations/editorannotations.d.ts +67 -67
  16. package/src/annotations/editorannotations.js +1 -1
  17. package/src/annotations/inlineannotations.d.ts +90 -90
  18. package/src/annotations/inlineannotations.js +1 -1
  19. package/src/annotations/narrowsidebar.d.ts +85 -85
  20. package/src/annotations/narrowsidebar.js +1 -1
  21. package/src/annotations/sidebar.d.ts +100 -100
  22. package/src/annotations/sidebar.js +1 -1
  23. package/src/annotations/view/annotationcounterbuttonview.d.ts +29 -29
  24. package/src/annotations/view/annotationcounterbuttonview.js +1 -1
  25. package/src/annotations/view/annotationview.d.ts +90 -90
  26. package/src/annotations/view/annotationview.js +1 -1
  27. package/src/annotations/view/sidebaritemview.d.ts +55 -55
  28. package/src/annotations/view/sidebaritemview.js +1 -1
  29. package/src/annotations/view/sidebarview.d.ts +32 -32
  30. package/src/annotations/view/sidebarview.js +1 -1
  31. package/src/annotations/widesidebar.d.ts +77 -77
  32. package/src/annotations/widesidebar.js +1 -1
  33. package/src/augmentation.d.ts +52 -52
  34. package/src/comments/addcommentthreadcommand.d.ts +35 -35
  35. package/src/comments/addcommentthreadcommand.js +1 -1
  36. package/src/comments/commentsarchive.d.ts +31 -31
  37. package/src/comments/commentsarchive.js +1 -1
  38. package/src/comments/commentsarchiveui.d.ts +38 -38
  39. package/src/comments/commentsarchiveui.js +1 -1
  40. package/src/comments/commentsediting.d.ts +79 -79
  41. package/src/comments/commentsediting.js +1 -1
  42. package/src/comments/commentsrepository.d.ts +1129 -1105
  43. package/src/comments/commentsrepository.js +1 -1
  44. package/src/comments/commentsui.d.ts +33 -33
  45. package/src/comments/commentsui.js +1 -1
  46. package/src/comments/integrations/commentsrestrictededitingmode.d.ts +17 -17
  47. package/src/comments/integrations/commentsrestrictededitingmode.js +1 -1
  48. package/src/comments/integrations/importword.d.ts +21 -21
  49. package/src/comments/integrations/importword.js +1 -1
  50. package/src/comments/ui/commenteditor/commenteditor.d.ts +36 -36
  51. package/src/comments/ui/commenteditor/commenteditor.js +1 -1
  52. package/src/comments/ui/commenteditor/commenteditorui.d.ts +31 -31
  53. package/src/comments/ui/commenteditor/commenteditorui.js +1 -1
  54. package/src/comments/ui/commenteditor/commenteditoruiview.d.ts +36 -36
  55. package/src/comments/ui/commenteditor/commenteditoruiview.js +1 -1
  56. package/src/comments/ui/commentthreadcontroller.d.ts +64 -64
  57. package/src/comments/ui/commentthreadcontroller.js +1 -1
  58. package/src/comments/ui/view/basecommentthreadview.d.ts +119 -112
  59. package/src/comments/ui/view/basecommentthreadview.js +1 -1
  60. package/src/comments/ui/view/basecommentview.d.ts +112 -112
  61. package/src/comments/ui/view/basecommentview.js +1 -1
  62. package/src/comments/ui/view/collapsedcommentsview.d.ts +13 -13
  63. package/src/comments/ui/view/collapsedcommentsview.js +1 -1
  64. package/src/comments/ui/view/commentcontentview.d.ts +14 -14
  65. package/src/comments/ui/view/commentcontentview.js +1 -1
  66. package/src/comments/ui/view/commentinputview.d.ts +86 -86
  67. package/src/comments/ui/view/commentinputview.js +1 -1
  68. package/src/comments/ui/view/commentsarchiveview.d.ts +38 -38
  69. package/src/comments/ui/view/commentsarchiveview.js +1 -1
  70. package/src/comments/ui/view/commentslistview.d.ts +100 -100
  71. package/src/comments/ui/view/commentslistview.js +1 -1
  72. package/src/comments/ui/view/commentthreadheaderview.d.ts +50 -50
  73. package/src/comments/ui/view/commentthreadheaderview.js +1 -1
  74. package/src/comments/ui/view/commentthreadinputview.d.ts +41 -41
  75. package/src/comments/ui/view/commentthreadinputview.js +1 -1
  76. package/src/comments/ui/view/commentthreadview.d.ts +118 -117
  77. package/src/comments/ui/view/commentthreadview.js +1 -1
  78. package/src/comments/ui/view/commentview.d.ts +243 -243
  79. package/src/comments/ui/view/commentview.js +1 -1
  80. package/src/comments.d.ts +35 -35
  81. package/src/comments.js +1 -1
  82. package/src/commentsonly.d.ts +33 -33
  83. package/src/commentsonly.js +1 -1
  84. package/src/config.d.ts +176 -176
  85. package/src/index.d.ts +24 -24
  86. package/src/utils/common-translations.d.ts +9 -9
  87. package/src/utils/common-translations.js +1 -1
  88. package/src/utils/createmutationobserver.d.ts +14 -14
  89. package/src/utils/createmutationobserver.js +1 -1
  90. package/theme/annotation-inline.css +2 -1
  91. package/theme/annotation.css +2 -1
  92. package/theme/comment.css +2 -1
  93. package/theme/commentinput.css +2 -1
  94. package/theme/commentmarker.css +2 -1
  95. package/theme/commentsarchive.css +2 -1
  96. package/theme/commentthread.css +12 -1
  97. package/theme/icons/add-comment.svg +1 -1
  98. package/theme/icons/comments-archive.svg +1 -1
  99. package/theme/icons/edit-comment.svg +1 -1
  100. package/theme/icons/remove-comment.svg +1 -1
  101. package/theme/sidebar-narrow.css +2 -1
  102. package/theme/sidebar.css +2 -1
@@ -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 _0x5d8e=['push','get','_removeActiveAnnotation','annotationsuis-missing-ui','activeAnnotations','context','from','_addActiveAnnotation','function','refilterAnnotations','annotationsuis-register-invalid-interface','deactivate','deactivateAll','_uis','detach','_uisData','size','change:activeAnnotation','length','_assertAnnotationDoesNotBelongToMultipleUIs','setActiveAnnotation','annotationsuis-register-already-registered','_visibleAnnotations','isActive','attach','listenTo','collection','delete','activeUIs','filter','has','plugins','_setSelectedAnnotations','switchTo','set','register','_activateAnnotation','annotationsuis-annotation-mismatch','destroy','add','AnnotationsUIs','activate'];(function(_0xd4d5c2,_0x5d8e17){const _0x179655=function(_0x281a22){while(--_0x281a22){_0xd4d5c2['push'](_0xd4d5c2['shift']());}};_0x179655(++_0x5d8e17);}(_0x5d8e,0x9b));const _0x1796=function(_0xd4d5c2,_0x5d8e17){_0xd4d5c2=_0xd4d5c2-0x0;let _0x179655=_0x5d8e[_0xd4d5c2];return _0x179655;};import{ContextPlugin as _0x3ce081}from'ckeditor5/src/core';import{CKEditorError as _0x36e025}from'ckeditor5/src/utils';import _0x1d995f,{bindAnnotationCollections as _0x5a7ddb}from'./annotationcollection';import _0x28ad51 from'./annotations';export default class M extends _0x3ce081{static get['requires'](){return[_0x28ad51];}static get['pluginName'](){return _0x1796('0xb');}constructor(_0x5cf027){super(_0x5cf027),this[_0x1796('0x29')]=new Set(),this['_uis']=new Map(),this[_0x1796('0x1c')]=new Map();}['init'](){const _0x3cc2d8=this['context']['plugins'][_0x1796('0xe')](_0x28ad51);this[_0x1796('0x26')](_0x3cc2d8,_0x1796('0x7'),(_0x4ee690,_0x1964f6)=>{for(const _0x22e83c of this[_0x1796('0x29')]){const _0x4fd267=this[_0x1796('0x1a')]['get'](_0x22e83c);(0x0,this[_0x1796('0x1c')][_0x1796('0xe')](_0x22e83c)[_0x1796('0x0')])(_0x1964f6)&&_0x4fd267[_0x1796('0x21')](_0x1964f6);}}),this[_0x1796('0x26')](_0x3cc2d8,'_deactivateAllAnnotations',()=>{for(const _0x2637c5 of this['activeUIs']){this[_0x1796('0x1a')][_0x1796('0xe')](_0x2637c5)[_0x1796('0x21')](null);}}),this[_0x1796('0x26')](_0x3cc2d8[_0x1796('0x23')],_0x1796('0xa'),(_0x8d4f3b,_0x347311)=>{this[_0x1796('0x20')](_0x347311);});}['hasActive'](){return this[_0x1796('0x29')][_0x1796('0x1d')]>0x0;}[_0x1796('0x24')](_0x17233f){return this[_0x1796('0x29')][_0x1796('0x1')](_0x17233f);}[_0x1796('0xc')](_0x101f96,_0xa749bb=()=>!0x0){const _0x4eb829=this[_0x1796('0x12')]['plugins'][_0x1796('0xe')](_0x28ad51);if(!this[_0x1796('0x1a')][_0x1796('0x1')](_0x101f96))throw new _0x36e025('annotationsuis-missing-ui',this,{'uiName':_0x101f96});this[_0x1796('0x24')](_0x101f96)&&this[_0x1796('0x18')](_0x101f96),this[_0x1796('0x29')]['add'](_0x101f96);const _0x3293a2=new _0x1d995f(),_0x292b7a=_0x4eb829[_0x1796('0x23')];_0x5a7ddb({'source':_0x292b7a,'target':_0x3293a2,'filter':_0xa749bb}),this[_0x1796('0x1c')][_0x1796('0x5')](_0x101f96,{'collection':_0x3293a2,'filter':_0xa749bb});const _0x469d20=this[_0x1796('0x1a')][_0x1796('0xe')](_0x101f96);_0x469d20[_0x1796('0x25')](_0x3293a2),this[_0x1796('0x26')](_0x469d20,_0x1796('0x1e'),(_0x14519a,_0x39fc9f,_0x2b26ac,_0x5db4fa)=>{_0x5db4fa&&_0x4eb829[_0x1796('0xf')](_0x5db4fa),_0x2b26ac&&_0x4eb829[_0x1796('0x14')](_0x2b26ac);});}[_0x1796('0x18')](_0x55ce40){if(this[_0x1796('0x29')][_0x1796('0x28')](_0x55ce40),!this['_uis'][_0x1796('0x1')](_0x55ce40))throw new _0x36e025(_0x1796('0x10'),this,{'uiName':_0x55ce40});const _0x12aa6f=this['_uis'][_0x1796('0xe')](_0x55ce40);_0x12aa6f[_0x1796('0x1b')](),this['stopListening'](_0x12aa6f),this[_0x1796('0x1c')][_0x1796('0xe')](_0x55ce40)[_0x1796('0x27')]['destroy'](),this[_0x1796('0x1c')][_0x1796('0x28')](_0x55ce40);}[_0x1796('0x4')](_0x507e12){if(!this['_uis'][_0x1796('0x1')](_0x507e12))throw new _0x36e025(_0x1796('0x10'),this,{'uiName':_0x507e12});const _0x45f7df=this[_0x1796('0x12')][_0x1796('0x2')]['get'](_0x28ad51),_0x2112f1=Array['from'](_0x45f7df[_0x1796('0x11')])[0x0]||null;this[_0x1796('0x19')](),this['activate'](_0x507e12);const _0xd658d6=this[_0x1796('0x1a')][_0x1796('0xe')](_0x507e12);_0xd658d6[_0x1796('0x21')](_0x2112f1),_0xd658d6['_setSelectedAnnotations']&&_0x2112f1&&_0xd658d6[_0x1796('0x3')]([_0x2112f1]);}[_0x1796('0x19')](){for(const _0x2019e0 of this[_0x1796('0x29')])this[_0x1796('0x18')](_0x2019e0);}[_0x1796('0x6')](_0x4b040f,_0x1e526d){if(this[_0x1796('0x1a')][_0x1796('0x1')](_0x4b040f))throw new _0x36e025(_0x1796('0x22'));if(_0x1796('0x15')!=typeof _0x1e526d[_0x1796('0x25')]||_0x1796('0x15')!=typeof _0x1e526d[_0x1796('0x1b')]||_0x1796('0x15')!=typeof _0x1e526d[_0x1796('0x21')])throw new _0x36e025(_0x1796('0x17'),null);this[_0x1796('0x1a')]['set'](_0x4b040f,_0x1e526d);}[_0x1796('0x16')](){const _0x172430=this[_0x1796('0x12')][_0x1796('0x2')][_0x1796('0xe')](_0x28ad51)[_0x1796('0x27')],_0x53c910=new Map(),_0xaeb4fd=Array[_0x1796('0x13')](this[_0x1796('0x29')]);for(const _0x4fa98c of this[_0x1796('0x29')]){const _0xb4b8c1=this['_uisData'][_0x1796('0xe')](_0x4fa98c)[_0x1796('0x27')];for(const _0x166eca of _0xb4b8c1)_0x53c910['set'](_0x166eca,_0x4fa98c);}for(const _0xa4caf3 of _0x172430){const _0x2b57e8=_0x53c910[_0x1796('0xe')](_0xa4caf3);this[_0x1796('0x20')](_0xa4caf3);const _0x40405d=_0xaeb4fd['find'](_0x415caa=>this[_0x1796('0x1c')][_0x1796('0xe')](_0x415caa)[_0x1796('0x0')](_0xa4caf3));_0x2b57e8!==_0x40405d&&(_0x2b57e8&&this[_0x1796('0x1c')]['get'](_0x2b57e8)[_0x1796('0x27')]['remove'](_0xa4caf3),_0x40405d&&this[_0x1796('0x1c')]['get'](_0x40405d)[_0x1796('0x27')][_0x1796('0xa')](_0xa4caf3));}}['destroy'](){this['deactivateAll'](),super[_0x1796('0x9')]();}[_0x1796('0x20')](_0x4f4a26){const _0x3dc0ba=[];for(const _0x24a0d8 of this[_0x1796('0x29')]){(0x0,this['_uisData']['get'](_0x24a0d8)[_0x1796('0x0')])(_0x4f4a26)&&_0x3dc0ba[_0x1796('0xd')](_0x24a0d8);}if(_0x3dc0ba[_0x1796('0x1f')]>0x1)throw new _0x36e025(_0x1796('0x8'),null,{'matchedUIs':_0x3dc0ba,'annotationType':_0x4f4a26['type']});}}
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')]});}}