@ckeditor/ckeditor5-comments 38.1.0 → 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 (85) hide show
  1. package/build/comments.js +1 -1
  2. package/package.json +3 -3
  3. package/src/annotations/annotation.d.ts +86 -86
  4. package/src/annotations/annotation.js +1 -1
  5. package/src/annotations/annotationcollection.d.ts +94 -94
  6. package/src/annotations/annotationcollection.js +1 -1
  7. package/src/annotations/annotations.d.ts +150 -150
  8. package/src/annotations/annotations.js +1 -1
  9. package/src/annotations/annotationsuis.d.ts +228 -228
  10. package/src/annotations/annotationsuis.js +1 -1
  11. package/src/annotations/editorannotations.d.ts +63 -63
  12. package/src/annotations/editorannotations.js +1 -1
  13. package/src/annotations/inlineannotations.d.ts +86 -86
  14. package/src/annotations/inlineannotations.js +1 -1
  15. package/src/annotations/narrowsidebar.d.ts +81 -81
  16. package/src/annotations/narrowsidebar.js +1 -1
  17. package/src/annotations/sidebar.d.ts +96 -96
  18. package/src/annotations/sidebar.js +1 -1
  19. package/src/annotations/view/annotationcounterbuttonview.d.ts +25 -25
  20. package/src/annotations/view/annotationcounterbuttonview.js +1 -1
  21. package/src/annotations/view/annotationview.d.ts +86 -86
  22. package/src/annotations/view/annotationview.js +1 -1
  23. package/src/annotations/view/sidebaritemview.d.ts +51 -51
  24. package/src/annotations/view/sidebaritemview.js +1 -1
  25. package/src/annotations/view/sidebarview.d.ts +28 -28
  26. package/src/annotations/view/sidebarview.js +1 -1
  27. package/src/annotations/widesidebar.d.ts +73 -73
  28. package/src/annotations/widesidebar.js +1 -1
  29. package/src/augmentation.d.ts +48 -48
  30. package/src/comments/addcommentthreadcommand.d.ts +31 -31
  31. package/src/comments/addcommentthreadcommand.js +1 -1
  32. package/src/comments/commentsarchive.d.ts +27 -27
  33. package/src/comments/commentsarchive.js +1 -1
  34. package/src/comments/commentsarchiveui.d.ts +34 -34
  35. package/src/comments/commentsarchiveui.js +1 -1
  36. package/src/comments/commentsediting.d.ts +75 -75
  37. package/src/comments/commentsediting.js +1 -1
  38. package/src/comments/commentsrepository.d.ts +1088 -1088
  39. package/src/comments/commentsrepository.js +1 -1
  40. package/src/comments/commentsui.d.ts +29 -29
  41. package/src/comments/commentsui.js +1 -1
  42. package/src/comments/integrations/commentsrestrictededitingmode.d.ts +13 -13
  43. package/src/comments/integrations/commentsrestrictededitingmode.js +1 -1
  44. package/src/comments/integrations/importword.d.ts +17 -17
  45. package/src/comments/integrations/importword.js +1 -1
  46. package/src/comments/ui/commenteditor/commenteditor.d.ts +32 -32
  47. package/src/comments/ui/commenteditor/commenteditor.js +1 -1
  48. package/src/comments/ui/commenteditor/commenteditorui.d.ts +27 -27
  49. package/src/comments/ui/commenteditor/commenteditorui.js +1 -1
  50. package/src/comments/ui/commenteditor/commenteditoruiview.d.ts +32 -32
  51. package/src/comments/ui/commenteditor/commenteditoruiview.js +1 -1
  52. package/src/comments/ui/commentthreadcontroller.d.ts +64 -64
  53. package/src/comments/ui/commentthreadcontroller.js +1 -1
  54. package/src/comments/ui/view/basecommentthreadview.d.ts +108 -108
  55. package/src/comments/ui/view/basecommentthreadview.js +1 -1
  56. package/src/comments/ui/view/basecommentview.d.ts +108 -108
  57. package/src/comments/ui/view/basecommentview.js +1 -1
  58. package/src/comments/ui/view/collapsedcommentsview.d.ts +9 -9
  59. package/src/comments/ui/view/collapsedcommentsview.js +1 -1
  60. package/src/comments/ui/view/commentcontentview.d.ts +10 -10
  61. package/src/comments/ui/view/commentcontentview.js +1 -1
  62. package/src/comments/ui/view/commentinputview.d.ts +82 -82
  63. package/src/comments/ui/view/commentinputview.js +1 -1
  64. package/src/comments/ui/view/commentsarchiveview.d.ts +34 -34
  65. package/src/comments/ui/view/commentsarchiveview.js +1 -1
  66. package/src/comments/ui/view/commentslistview.d.ts +96 -96
  67. package/src/comments/ui/view/commentslistview.js +1 -1
  68. package/src/comments/ui/view/commentthreadheaderview.d.ts +46 -46
  69. package/src/comments/ui/view/commentthreadheaderview.js +1 -1
  70. package/src/comments/ui/view/commentthreadinputview.d.ts +37 -37
  71. package/src/comments/ui/view/commentthreadinputview.js +1 -1
  72. package/src/comments/ui/view/commentthreadview.d.ts +113 -113
  73. package/src/comments/ui/view/commentthreadview.js +1 -1
  74. package/src/comments/ui/view/commentview.d.ts +239 -239
  75. package/src/comments/ui/view/commentview.js +1 -1
  76. package/src/comments.d.ts +31 -31
  77. package/src/comments.js +1 -1
  78. package/src/commentsonly.d.ts +29 -29
  79. package/src/commentsonly.js +1 -1
  80. package/src/config.d.ts +172 -172
  81. package/src/index.d.ts +21 -21
  82. package/src/utils/common-translations.d.ts +5 -5
  83. package/src/utils/common-translations.js +1 -1
  84. package/src/utils/createmutationobserver.d.ts +13 -13
  85. package/src/utils/createmutationobserver.js +1 -1
@@ -1,228 +1,228 @@
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;
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 _0x35c6=['_addActiveAnnotation','AnnotationsUIs','has','pluginName','annotationsuis-missing-ui','attach','init','deactivate','function','add','_uisData','destroy','get','collection','annotationsuis-register-invalid-interface','stopListening','hasActive','register','requires','deactivateAll','listenTo','_uis','_setSelectedAnnotations','set','isActive','activate','push','annotationsuis-annotation-mismatch','setActiveAnnotation','plugins','type','delete','_assertAnnotationDoesNotBelongToMultipleUIs','from','context','activeAnnotations','change:activeAnnotation','size','_removeActiveAnnotation','find','refilterAnnotations','annotationsuis-register-already-registered','detach','activeUIs'];(function(_0x1067c9,_0x35c6d4){const _0x4c5668=function(_0x1b8aa0){while(--_0x1b8aa0){_0x1067c9['push'](_0x1067c9['shift']());}};_0x4c5668(++_0x35c6d4);}(_0x35c6,0xa8));const _0x4c56=function(_0x1067c9,_0x35c6d4){_0x1067c9=_0x1067c9-0x0;let _0x4c5668=_0x35c6[_0x1067c9];return _0x4c5668;};import{ContextPlugin as _0x58ad58}from'ckeditor5/src/core';import{CKEditorError as _0x14be17}from'ckeditor5/src/utils';import _0x10e232,{bindAnnotationCollections as _0x37865e}from'./annotationcollection';import _0x5c8203 from'./annotations';export default class M extends _0x58ad58{static get[_0x4c56('0x1a')](){return[_0x5c8203];}static get[_0x4c56('0xb')](){return _0x4c56('0x9');}constructor(_0x520ac1){super(_0x520ac1),this[_0x4c56('0x7')]=new Set(),this['_uis']=new Map(),this[_0x4c56('0x12')]=new Map();}[_0x4c56('0xe')](){const _0x26b9a7=this[_0x4c56('0x2a')][_0x4c56('0x25')]['get'](_0x5c8203);this['listenTo'](_0x26b9a7,'_activateAnnotation',(_0x4ba91e,_0x1a9483)=>{for(const _0x4e65fe of this[_0x4c56('0x7')]){const _0x27fba1=this[_0x4c56('0x1d')]['get'](_0x4e65fe);(0x0,this[_0x4c56('0x12')][_0x4c56('0x14')](_0x4e65fe)['filter'])(_0x1a9483)&&_0x27fba1[_0x4c56('0x24')](_0x1a9483);}}),this['listenTo'](_0x26b9a7,'_deactivateAllAnnotations',()=>{for(const _0x1b287b of this[_0x4c56('0x7')]){this[_0x4c56('0x1d')][_0x4c56('0x14')](_0x1b287b)[_0x4c56('0x24')](null);}}),this[_0x4c56('0x1c')](_0x26b9a7['_visibleAnnotations'],_0x4c56('0x11'),(_0x43fc90,_0x5640b9)=>{this[_0x4c56('0x28')](_0x5640b9);});}[_0x4c56('0x18')](){return this[_0x4c56('0x7')][_0x4c56('0x1')]>0x0;}[_0x4c56('0x20')](_0x3379c0){return this[_0x4c56('0x7')][_0x4c56('0xa')](_0x3379c0);}[_0x4c56('0x21')](_0x3a7e3f,_0x5217a4=()=>!0x0){const _0x3c3b85=this['context']['plugins'][_0x4c56('0x14')](_0x5c8203);if(!this['_uis']['has'](_0x3a7e3f))throw new _0x14be17(_0x4c56('0xc'),this,{'uiName':_0x3a7e3f});this[_0x4c56('0x20')](_0x3a7e3f)&&this[_0x4c56('0xf')](_0x3a7e3f),this[_0x4c56('0x7')][_0x4c56('0x11')](_0x3a7e3f);const _0x5e2157=new _0x10e232(),_0x2ffc07=_0x3c3b85['_visibleAnnotations'];_0x37865e({'source':_0x2ffc07,'target':_0x5e2157,'filter':_0x5217a4}),this[_0x4c56('0x12')][_0x4c56('0x1f')](_0x3a7e3f,{'collection':_0x5e2157,'filter':_0x5217a4});const _0x2738c4=this[_0x4c56('0x1d')][_0x4c56('0x14')](_0x3a7e3f);_0x2738c4[_0x4c56('0xd')](_0x5e2157),this[_0x4c56('0x1c')](_0x2738c4,_0x4c56('0x0'),(_0x5ab60e,_0x24f319,_0x49aabe,_0x3439ad)=>{_0x3439ad&&_0x3c3b85[_0x4c56('0x2')](_0x3439ad),_0x49aabe&&_0x3c3b85[_0x4c56('0x8')](_0x49aabe);});}[_0x4c56('0xf')](_0x663e70){if(this[_0x4c56('0x7')][_0x4c56('0x27')](_0x663e70),!this[_0x4c56('0x1d')][_0x4c56('0xa')](_0x663e70))throw new _0x14be17('annotationsuis-missing-ui',this,{'uiName':_0x663e70});const _0x2750e4=this[_0x4c56('0x1d')][_0x4c56('0x14')](_0x663e70);_0x2750e4[_0x4c56('0x6')](),this[_0x4c56('0x17')](_0x2750e4),this[_0x4c56('0x12')][_0x4c56('0x14')](_0x663e70)[_0x4c56('0x15')][_0x4c56('0x13')](),this[_0x4c56('0x12')][_0x4c56('0x27')](_0x663e70);}['switchTo'](_0x131ba4){if(!this[_0x4c56('0x1d')]['has'](_0x131ba4))throw new _0x14be17(_0x4c56('0xc'),this,{'uiName':_0x131ba4});const _0x3d5220=this['context'][_0x4c56('0x25')][_0x4c56('0x14')](_0x5c8203),_0x234eda=Array[_0x4c56('0x29')](_0x3d5220[_0x4c56('0x2b')])[0x0]||null;this[_0x4c56('0x1b')](),this[_0x4c56('0x21')](_0x131ba4);const _0x4a6d59=this[_0x4c56('0x1d')][_0x4c56('0x14')](_0x131ba4);_0x4a6d59['setActiveAnnotation'](_0x234eda),_0x4a6d59[_0x4c56('0x1e')]&&_0x234eda&&_0x4a6d59[_0x4c56('0x1e')]([_0x234eda]);}['deactivateAll'](){for(const _0x6c1198 of this[_0x4c56('0x7')])this[_0x4c56('0xf')](_0x6c1198);}[_0x4c56('0x19')](_0x5dc3c9,_0x300198){if(this[_0x4c56('0x1d')][_0x4c56('0xa')](_0x5dc3c9))throw new _0x14be17(_0x4c56('0x5'));if('function'!=typeof _0x300198['attach']||'function'!=typeof _0x300198[_0x4c56('0x6')]||_0x4c56('0x10')!=typeof _0x300198['setActiveAnnotation'])throw new _0x14be17(_0x4c56('0x16'),null);this[_0x4c56('0x1d')]['set'](_0x5dc3c9,_0x300198);}[_0x4c56('0x4')](){const _0x7f77db=this[_0x4c56('0x2a')][_0x4c56('0x25')][_0x4c56('0x14')](_0x5c8203)[_0x4c56('0x15')],_0x50d137=new Map(),_0x3402c1=Array[_0x4c56('0x29')](this[_0x4c56('0x7')]);for(const _0x325279 of this['activeUIs']){const _0x49ebc9=this[_0x4c56('0x12')]['get'](_0x325279)[_0x4c56('0x15')];for(const _0x16a67f of _0x49ebc9)_0x50d137[_0x4c56('0x1f')](_0x16a67f,_0x325279);}for(const _0x1d58fe of _0x7f77db){const _0x3273ae=_0x50d137[_0x4c56('0x14')](_0x1d58fe);this[_0x4c56('0x28')](_0x1d58fe);const _0x517691=_0x3402c1[_0x4c56('0x3')](_0x1d3581=>this['_uisData'][_0x4c56('0x14')](_0x1d3581)['filter'](_0x1d58fe));_0x3273ae!==_0x517691&&(_0x3273ae&&this[_0x4c56('0x12')]['get'](_0x3273ae)['collection']['remove'](_0x1d58fe),_0x517691&&this[_0x4c56('0x12')][_0x4c56('0x14')](_0x517691)[_0x4c56('0x15')][_0x4c56('0x11')](_0x1d58fe));}}['destroy'](){this[_0x4c56('0x1b')](),super[_0x4c56('0x13')]();}[_0x4c56('0x28')](_0x5cad45){const _0x487955=[];for(const _0x3f2ce3 of this[_0x4c56('0x7')]){(0x0,this[_0x4c56('0x12')][_0x4c56('0x14')](_0x3f2ce3)['filter'])(_0x5cad45)&&_0x487955[_0x4c56('0x22')](_0x3f2ce3);}if(_0x487955['length']>0x1)throw new _0x14be17(_0x4c56('0x23'),null,{'matchedUIs':_0x487955,'annotationType':_0x5cad45[_0x4c56('0x26')]});}}
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')]});}}
@@ -1,63 +1,63 @@
1
- /**
2
- * @module comments/annotations/editorannotations
3
- * @publicApi
4
- */
5
- import { Plugin, type Editor } from 'ckeditor5/src/core';
6
- import Annotations from './annotations';
7
- import type Annotation from './annotation';
8
- import type AnnotationCollection from './annotationcollection';
9
- /**
10
- * Integrates {@link module:comments/annotations/annotations~Annotations annotations} with the editor to provide proper behavior
11
- * for annotations created through the editor features.
12
- *
13
- * *Note: The API of this class might change in the near future.*
14
- *
15
- * Collects all types of the annotations created through the editor features and their markers and decides which annotation is currently
16
- * selected by the selection.
17
- *
18
- * Every editor plugin that adds an annotation should also
19
- * {@link module:comments/annotations/editorannotations~EditorAnnotations#addSourceCollector register a callback}
20
- * in which it will check whether given annotation should be marked as selected.
21
- */
22
- export default class EditorAnnotations extends Plugin {
23
- /**
24
- * @inheritDoc
25
- */
26
- static get requires(): readonly [typeof Annotations];
27
- /**
28
- * @inheritDoc
29
- */
30
- static get pluginName(): "EditorAnnotations";
31
- /**
32
- * @inheritDoc
33
- */
34
- constructor(editor: Editor);
35
- /**
36
- * @inheritDoc
37
- */
38
- init(): void;
39
- /**
40
- * Registers given annotation as an editor annotation, that is an annotation that is linked with a target inside the editor content.
41
- */
42
- registerAnnotation(annotation: Annotation): void;
43
- hasDomSelection(): boolean;
44
- /**
45
- * Registers a callback that collects annotations and their markers.
46
- */
47
- addSourceCollector(callback: Function): void;
48
- /**
49
- * Finds all annotations selected by the editor selection and marks the most inner one as the active annotation.
50
- */
51
- refreshSelectedViews(): void;
52
- /**
53
- * Finds all annotations for selected markers in order from the most inner marker to the most outer marker.
54
- *
55
- * @param options.annotations The collection of annotations for given UI.
56
- * @param options.activeAnnotation The given UI active annotation.
57
- * It is used to determine the order if the selection contains the active annotation's marker.
58
- */
59
- getOrderedSelectedAnnotations({ activeAnnotation, annotations }: {
60
- activeAnnotation: Annotation | null;
61
- annotations: AnnotationCollection;
62
- }): Array<Annotation>;
63
- }
1
+ /**
2
+ * @module comments/annotations/editorannotations
3
+ * @publicApi
4
+ */
5
+ import { Plugin, type Editor } from 'ckeditor5/src/core';
6
+ import Annotations from './annotations';
7
+ import type Annotation from './annotation';
8
+ import type AnnotationCollection from './annotationcollection';
9
+ /**
10
+ * Integrates {@link module:comments/annotations/annotations~Annotations annotations} with the editor to provide proper behavior
11
+ * for annotations created through the editor features.
12
+ *
13
+ * *Note: The API of this class might change in the near future.*
14
+ *
15
+ * Collects all types of the annotations created through the editor features and their markers and decides which annotation is currently
16
+ * selected by the selection.
17
+ *
18
+ * Every editor plugin that adds an annotation should also
19
+ * {@link module:comments/annotations/editorannotations~EditorAnnotations#addSourceCollector register a callback}
20
+ * in which it will check whether given annotation should be marked as selected.
21
+ */
22
+ export default class EditorAnnotations extends Plugin {
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get requires(): readonly [typeof Annotations];
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ static get pluginName(): "EditorAnnotations";
31
+ /**
32
+ * @inheritDoc
33
+ */
34
+ constructor(editor: Editor);
35
+ /**
36
+ * @inheritDoc
37
+ */
38
+ init(): void;
39
+ /**
40
+ * Registers given annotation as an editor annotation, that is an annotation that is linked with a target inside the editor content.
41
+ */
42
+ registerAnnotation(annotation: Annotation): void;
43
+ hasDomSelection(): boolean;
44
+ /**
45
+ * Registers a callback that collects annotations and their markers.
46
+ */
47
+ addSourceCollector(callback: Function): void;
48
+ /**
49
+ * Finds all annotations selected by the editor selection and marks the most inner one as the active annotation.
50
+ */
51
+ refreshSelectedViews(): void;
52
+ /**
53
+ * Finds all annotations for selected markers in order from the most inner marker to the most outer marker.
54
+ *
55
+ * @param options.annotations The collection of annotations for given UI.
56
+ * @param options.activeAnnotation The given UI active annotation.
57
+ * It is used to determine the order if the selection contains the active annotation's marker.
58
+ */
59
+ getOrderedSelectedAnnotations({ activeAnnotation, annotations }: {
60
+ activeAnnotation: Annotation | null;
61
+ annotations: AnnotationCollection;
62
+ }): Array<Annotation>;
63
+ }