@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.
- package/build/comments.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sq.js +1 -0
- package/lang/translations/en-au.po +1 -1
- package/lang/translations/it.po +1 -1
- package/lang/translations/lv.po +1 -1
- package/lang/translations/pt-br.po +1 -1
- package/lang/translations/sk.po +1 -1
- package/lang/translations/sq.po +111 -0
- package/package.json +10 -8
- package/src/annotations/annotation.d.ts +86 -86
- package/src/annotations/annotation.js +1 -1
- package/src/annotations/annotationcollection.d.ts +94 -94
- package/src/annotations/annotationcollection.js +1 -1
- package/src/annotations/annotations.d.ts +150 -150
- package/src/annotations/annotations.js +1 -1
- package/src/annotations/annotationsuis.d.ts +228 -227
- package/src/annotations/annotationsuis.js +1 -1
- package/src/annotations/editorannotations.d.ts +63 -62
- package/src/annotations/editorannotations.js +1 -1
- package/src/annotations/inlineannotations.d.ts +86 -84
- package/src/annotations/inlineannotations.js +1 -1
- package/src/annotations/narrowsidebar.d.ts +81 -80
- package/src/annotations/narrowsidebar.js +1 -1
- package/src/annotations/sidebar.d.ts +96 -96
- package/src/annotations/sidebar.js +1 -1
- package/src/annotations/view/annotationcounterbuttonview.d.ts +25 -25
- package/src/annotations/view/annotationcounterbuttonview.js +1 -1
- package/src/annotations/view/annotationview.d.ts +86 -86
- package/src/annotations/view/annotationview.js +1 -1
- package/src/annotations/view/sidebaritemview.d.ts +51 -51
- package/src/annotations/view/sidebaritemview.js +1 -1
- package/src/annotations/view/sidebarview.d.ts +28 -28
- package/src/annotations/view/sidebarview.js +1 -1
- package/src/annotations/widesidebar.d.ts +73 -72
- package/src/annotations/widesidebar.js +1 -1
- package/src/augmentation.d.ts +48 -48
- package/src/comments/addcommentthreadcommand.d.ts +31 -31
- package/src/comments/addcommentthreadcommand.js +1 -1
- package/src/comments/commentsarchive.d.ts +27 -25
- package/src/comments/commentsarchive.js +1 -1
- package/src/comments/commentsarchiveui.d.ts +34 -32
- package/src/comments/commentsarchiveui.js +1 -1
- package/src/comments/commentsediting.d.ts +75 -71
- package/src/comments/commentsediting.js +1 -1
- package/src/comments/commentsrepository.d.ts +1088 -1084
- package/src/comments/commentsrepository.js +1 -1
- package/src/comments/commentsui.d.ts +29 -25
- package/src/comments/commentsui.js +1 -1
- package/src/comments/integrations/commentsrestrictededitingmode.d.ts +13 -13
- package/src/comments/integrations/commentsrestrictededitingmode.js +1 -1
- package/src/comments/integrations/importword.d.ts +17 -17
- package/src/comments/integrations/importword.js +1 -1
- package/src/comments/ui/commenteditor/commenteditor.d.ts +32 -32
- package/src/comments/ui/commenteditor/commenteditor.js +1 -1
- package/src/comments/ui/commenteditor/commenteditorui.d.ts +27 -27
- package/src/comments/ui/commenteditor/commenteditorui.js +1 -1
- package/src/comments/ui/commenteditor/commenteditoruiview.d.ts +32 -32
- package/src/comments/ui/commenteditor/commenteditoruiview.js +1 -1
- package/src/comments/ui/commentthreadcontroller.d.ts +64 -64
- package/src/comments/ui/commentthreadcontroller.js +1 -1
- package/src/comments/ui/view/basecommentthreadview.d.ts +108 -108
- package/src/comments/ui/view/basecommentthreadview.js +1 -1
- package/src/comments/ui/view/basecommentview.d.ts +108 -108
- package/src/comments/ui/view/basecommentview.js +1 -1
- package/src/comments/ui/view/collapsedcommentsview.d.ts +9 -9
- package/src/comments/ui/view/collapsedcommentsview.js +1 -1
- package/src/comments/ui/view/commentcontentview.d.ts +10 -10
- package/src/comments/ui/view/commentcontentview.js +1 -1
- package/src/comments/ui/view/commentinputview.d.ts +82 -82
- package/src/comments/ui/view/commentinputview.js +1 -1
- package/src/comments/ui/view/commentsarchiveview.d.ts +34 -34
- package/src/comments/ui/view/commentsarchiveview.js +1 -1
- package/src/comments/ui/view/commentslistview.d.ts +96 -96
- package/src/comments/ui/view/commentslistview.js +1 -1
- package/src/comments/ui/view/commentthreadheaderview.d.ts +46 -46
- package/src/comments/ui/view/commentthreadheaderview.js +1 -1
- package/src/comments/ui/view/commentthreadinputview.d.ts +37 -37
- package/src/comments/ui/view/commentthreadinputview.js +1 -1
- package/src/comments/ui/view/commentthreadview.d.ts +113 -113
- package/src/comments/ui/view/commentthreadview.js +1 -1
- package/src/comments/ui/view/commentview.d.ts +239 -239
- package/src/comments/ui/view/commentview.js +1 -1
- package/src/comments.d.ts +31 -22
- package/src/comments.js +1 -1
- package/src/commentsonly.d.ts +29 -28
- package/src/commentsonly.js +1 -1
- package/src/config.d.ts +172 -172
- package/src/index.d.ts +21 -19
- package/src/index.js +1 -1
- package/src/utils/common-translations.d.ts +5 -5
- package/src/utils/common-translations.js +1 -1
- package/src/utils/createmutationobserver.d.ts +13 -13
- 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
|
|
6
|
-
import { type Emitter } from 'ckeditor5/src/utils';
|
|
7
|
-
import AnnotationCollection from './annotationcollection';
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* the
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* {@link module:comments/annotations/
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* @param
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* * {@link module:comments/annotations/
|
|
118
|
-
* * {@link module:comments/annotations/
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* @param
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* {@link module:core/
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* * {@link module:comments/annotations/
|
|
152
|
-
* * {@link module:comments/annotations/
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* this.activeAnnotation
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
* property.
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
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
|
|
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')]});}}
|