@ckeditor/ckeditor5-comments 48.2.0 → 48.3.0-alpha.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.
- package/dist/annotations/annotation.d.ts +84 -87
- package/dist/annotations/annotationcollection.d.ts +83 -83
- package/dist/annotations/annotations.d.ts +148 -148
- package/dist/annotations/annotationsuis.d.ts +235 -235
- package/dist/annotations/editorannotations.d.ts +71 -71
- package/dist/annotations/inlineannotations.d.ts +93 -93
- package/dist/annotations/narrowsidebar.d.ts +88 -88
- package/dist/annotations/sidebar.d.ts +105 -105
- package/dist/annotations/view/annotationcounterbuttonview.d.ts +24 -24
- package/dist/annotations/view/annotationview.d.ts +83 -83
- package/dist/annotations/view/sidebaritemview.d.ts +54 -54
- package/dist/annotations/view/sidebarview.d.ts +48 -48
- package/dist/annotations/widesidebar.d.ts +80 -80
- package/dist/augmentation.d.ts +57 -57
- package/dist/comments/addcommentthreadcommand.d.ts +69 -69
- package/dist/comments/commentsarchive.d.ts +34 -34
- package/dist/comments/commentsarchiveui.d.ts +48 -48
- package/dist/comments/commentsediting.d.ts +90 -90
- package/dist/comments/commentsrepository.d.ts +1042 -1054
- package/dist/comments/commentsui.d.ts +40 -40
- package/dist/comments/integrations/clipboard.d.ts +21 -21
- package/dist/comments/integrations/commentsrestrictededitingmode.d.ts +12 -12
- package/dist/comments/integrations/importword.d.ts +16 -16
- package/dist/comments/integrations/showcommenthighlights.d.ts +14 -14
- package/dist/comments/ui/commenteditor/commenteditor.d.ts +33 -32
- package/dist/comments/ui/commenteditor/commenteditorui.d.ts +27 -27
- package/dist/comments/ui/commenteditor/commenteditoruiview.d.ts +32 -32
- package/dist/comments/ui/commentthreadcontroller.d.ts +62 -60
- package/dist/comments/ui/view/basecommentthreadview.d.ts +134 -134
- package/dist/comments/ui/view/basecommentview.d.ts +136 -136
- package/dist/comments/ui/view/collapsedcommentsview.d.ts +9 -9
- package/dist/comments/ui/view/commentcontentview.d.ts +10 -10
- package/dist/comments/ui/view/commentinputview.d.ts +93 -93
- package/dist/comments/ui/view/commentsarchiveview.d.ts +41 -41
- package/dist/comments/ui/view/commentslistview.d.ts +107 -107
- package/dist/comments/ui/view/commentthreadheadercontextview.d.ts +19 -19
- package/dist/comments/ui/view/commentthreadheaderview.d.ts +67 -67
- package/dist/comments/ui/view/commentthreadinputview.d.ts +51 -51
- package/dist/comments/ui/view/commentthreadview.d.ts +116 -116
- package/dist/comments/ui/view/commentview.d.ts +225 -230
- package/dist/comments.d.ts +38 -38
- package/dist/commentsonly.d.ts +36 -36
- package/dist/config.d.ts +186 -186
- package/dist/index.d.ts +35 -35
- package/dist/index.js +11 -11
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/dist/utils/common-translations.d.ts +6 -6
- package/dist/utils/createmutationobserver.d.ts +9 -9
- package/dist/utils/splitmarkername.d.ts +10 -10
- package/package.json +16 -16
|
@@ -1,244 +1,244 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { ContextPlugin, type Plugin, type Editor, type Context } from
|
|
10
|
-
import { type Emitter } from
|
|
11
|
-
import { AnnotationCollection } from
|
|
12
|
-
import { Annotations } from
|
|
13
|
-
import { type Annotation } from
|
|
6
|
+
* @module comments/annotations/annotationsuis
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { ContextPlugin, type Plugin, type Editor, type Context, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
10
|
+
import { type Emitter } from "@ckeditor/ckeditor5-utils";
|
|
11
|
+
import { AnnotationCollection } from "./annotationcollection.js";
|
|
12
|
+
import { Annotations } from "./annotations.js";
|
|
13
|
+
import { type Annotation } from "./annotation.js";
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
53
|
export declare class AnnotationsUIs extends ContextPlugin {
|
|
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
|
-
|
|
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
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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(): PluginDependenciesOf<[Annotations]>;
|
|
65
|
+
/**
|
|
66
|
+
* @inheritDoc
|
|
67
|
+
*/
|
|
68
|
+
static get pluginName(): "AnnotationsUIs";
|
|
69
|
+
/**
|
|
70
|
+
* @inheritDoc
|
|
71
|
+
*/
|
|
72
|
+
static override get isOfficialPlugin(): true;
|
|
73
|
+
/**
|
|
74
|
+
* @inheritDoc
|
|
75
|
+
*/
|
|
76
|
+
static override get isPremiumPlugin(): true;
|
|
77
|
+
/**
|
|
78
|
+
* @inheritDoc
|
|
79
|
+
*/
|
|
80
|
+
constructor(context: Context | Editor);
|
|
81
|
+
/**
|
|
82
|
+
* @inheritDoc
|
|
83
|
+
*/
|
|
84
|
+
init(): void;
|
|
85
|
+
/**
|
|
86
|
+
* Returns `true` if at least one registered UI is active.
|
|
87
|
+
*/
|
|
88
|
+
hasActive(): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Returns `true` if the given UI is active.
|
|
91
|
+
*/
|
|
92
|
+
isActive(uiName: string): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Activates an annotations UI.
|
|
95
|
+
*
|
|
96
|
+
* Note that the custom annotations UI should be {@link #register registered} before the activation.
|
|
97
|
+
*
|
|
98
|
+
* The `filter` parameter can be used to display on some of the annotations in the given annotations UI. Thanks to that,
|
|
99
|
+
* all annotations can be split into various annotations UIs.
|
|
100
|
+
*
|
|
101
|
+
* The `filter` function takes an {@link module:comments/annotations/annotation~Annotation} instance as the first and only parameter,
|
|
102
|
+
* and should return `true` if that annotation should be placed in the given annotations UI.
|
|
103
|
+
*
|
|
104
|
+
* @param uiName The name of the annotations UI to activate.
|
|
105
|
+
* @param filter The annotation filter function. If not specified, the UI will use all annotations.
|
|
106
|
+
*/
|
|
107
|
+
activate(uiName: string, filter?: (annotation: Annotation) => boolean): void;
|
|
108
|
+
/**
|
|
109
|
+
* Deactivates annotations UI with given name.
|
|
110
|
+
*
|
|
111
|
+
* @param uiName The name of the annotations UI to deactivate.
|
|
112
|
+
*/
|
|
113
|
+
deactivate(uiName: string): void;
|
|
114
|
+
/**
|
|
115
|
+
* Switches the annotations UI to the one with given name.
|
|
116
|
+
*
|
|
117
|
+
* It preserves the currently active annotation.
|
|
118
|
+
*
|
|
119
|
+
* @param uiName The name of the annotations UI to switch to.
|
|
120
|
+
*/
|
|
121
|
+
switchTo(uiName: string): void;
|
|
122
|
+
/**
|
|
123
|
+
* Deactivates all annotations UIs.
|
|
124
|
+
*/
|
|
125
|
+
deactivateAll(): void;
|
|
126
|
+
/**
|
|
127
|
+
* Registers an annotations UI. It might be one of:
|
|
128
|
+
*
|
|
129
|
+
* * {@link module:comments/annotations/widesidebar~WideSidebar},
|
|
130
|
+
* * {@link module:comments/annotations/narrowsidebar~NarrowSidebar},
|
|
131
|
+
* * {@link module:comments/annotations/inlineannotations~InlineAnnotations}.
|
|
132
|
+
*
|
|
133
|
+
* It is possible to provide your own, custom annotations UI plugin. It has to implement
|
|
134
|
+
* {@link module:comments/annotations/annotationsuis~AnnotationsUI the `AnnotationsUI` interface}.
|
|
135
|
+
*
|
|
136
|
+
* @param uiName Annotations UI name.
|
|
137
|
+
* @param annotationsUI Annotations UI plugin instance.
|
|
138
|
+
*/
|
|
139
|
+
register(uiName: string, annotationsUI: AnnotationsUI<ContextPlugin | Plugin>): void;
|
|
140
|
+
/**
|
|
141
|
+
* Refilters annotations to proper UIs based on filters provided earlier during the
|
|
142
|
+
* {@link module:comments/annotations/annotationsuis~AnnotationsUIs#activate annotations UIs activation}.
|
|
143
|
+
*
|
|
144
|
+
* This method should be used if the annotations UIs filtering functions return different results than before
|
|
145
|
+
* for some annotations. It only reattaches these annotations, which should change their UIs.
|
|
146
|
+
*/
|
|
147
|
+
refilterAnnotations(): void;
|
|
148
|
+
/**
|
|
149
|
+
* @inheritDoc
|
|
150
|
+
*/
|
|
151
|
+
override destroy(): void;
|
|
152
|
+
/**
|
|
153
|
+
* A default pass-by filter function that returns `true` for all annotations to be used when no filter for UI is provided.
|
|
154
|
+
*/
|
|
155
|
+
defaultFilter(): boolean;
|
|
156
156
|
}
|
|
157
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
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
158
|
+
* An interface for the annotations UI plugin class.
|
|
159
|
+
*
|
|
160
|
+
* The annotations UI class handles displaying, focusing, activating and hiding annotations views.
|
|
161
|
+
*
|
|
162
|
+
* The annotations UI class must be a plugin, so it has to extend the {@link module:core/plugin~Plugin} or
|
|
163
|
+
* {@link module:core/contextplugin~ContextPlugin} class.
|
|
164
|
+
*
|
|
165
|
+
* Examples of `AnnotationsUI` are:
|
|
166
|
+
*
|
|
167
|
+
* * {@link module:comments/annotations/widesidebar~WideSidebar},
|
|
168
|
+
* * {@link module:comments/annotations/narrowsidebar~NarrowSidebar},
|
|
169
|
+
* * {@link module:comments/annotations/inlineannotations~InlineAnnotations}.
|
|
170
|
+
*
|
|
171
|
+
* You can use the following snippet as a base for your own annotations UI:
|
|
172
|
+
*
|
|
173
|
+
* ```ts
|
|
174
|
+
* class MyAnnotationsUI extends ContextPlugin {
|
|
175
|
+
* constructor( ...args ) {
|
|
176
|
+
* super( ...args );
|
|
177
|
+
*
|
|
178
|
+
* this.set( 'activeAnnotation', null );
|
|
179
|
+
* }
|
|
180
|
+
*
|
|
181
|
+
* attach( annotations ) {
|
|
182
|
+
* // Do something when an annotation is added.
|
|
183
|
+
* this.listenTo( annotations, 'add', ( evt, annotation ) => { ... } );
|
|
184
|
+
*
|
|
185
|
+
* // Do something when an annotation is removed.
|
|
186
|
+
* this.listenTo( annotations, 'remove', ( evt, annotation ) => { ... } );
|
|
187
|
+
* }
|
|
188
|
+
*
|
|
189
|
+
* detach() {
|
|
190
|
+
* this.stopListening();
|
|
191
|
+
* }
|
|
192
|
+
*
|
|
193
|
+
* setActiveAnnotation( annotation ) {
|
|
194
|
+
* if ( this.activeAnnotation ) {
|
|
195
|
+
* this.activeAnnotation.isActive = false;
|
|
196
|
+
*
|
|
197
|
+
* // You can do something in your UI with the annotation that is no longer active.
|
|
198
|
+
* }
|
|
199
|
+
*
|
|
200
|
+
* this.activeAnnotation = annotation;
|
|
201
|
+
* this.activeAnnotation.isActive = true;
|
|
202
|
+
*
|
|
203
|
+
* // You can do something in your UI to highlight the active annotation.
|
|
204
|
+
* }
|
|
205
|
+
* }
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
208
|
export interface AnnotationUI {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
209
|
+
/**
|
|
210
|
+
* Observable `activeAnnotation` property. {@link module:comments/annotations/annotationsuis~AnnotationsUIs} listens to changes on that
|
|
211
|
+
* property.
|
|
212
|
+
*
|
|
213
|
+
* To make this property observable use `this.set( 'activeAnnotation', null )` in the constructor.
|
|
214
|
+
*/
|
|
215
|
+
activeAnnotation: Annotation | null;
|
|
216
|
+
/**
|
|
217
|
+
* Creates everything needed for the UI and attaches all listeners. This method is called when the UI is activated.
|
|
218
|
+
*
|
|
219
|
+
* The observable collection of annotations is passed as the first argument,
|
|
220
|
+
* and the annotations UI is responsible for reacting to its changes.
|
|
221
|
+
*/
|
|
222
|
+
attach: (annotationCollection: AnnotationCollection) => void;
|
|
223
|
+
/**
|
|
224
|
+
* Destroys the UI and removes all listeners. This method is called when the UI is deactivated.
|
|
225
|
+
*/
|
|
226
|
+
detach: () => void;
|
|
227
|
+
/**
|
|
228
|
+
* Sets or unsets the active annotation. This method is called when an annotation is activated, for example, user puts their
|
|
229
|
+
* selection into a marker connected with given annotation.
|
|
230
|
+
*
|
|
231
|
+
* This method should change the UI so the new active annotation is differentiated from other annotations.
|
|
232
|
+
*
|
|
233
|
+
* This method should set the
|
|
234
|
+
* {@link #activeAnnotation `AnnotationUI#activeAnnotation`} property.
|
|
235
|
+
*
|
|
236
|
+
* It also should set {@link module:comments/annotations/annotation~Annotation#isActive `Annotation#isActive`} of the deactivated
|
|
237
|
+
* and the activated annotation.
|
|
238
|
+
*
|
|
239
|
+
* @param annotation The new active annotation or null when no annotation is active.
|
|
240
|
+
*/
|
|
241
|
+
setActiveAnnotation: (annotation: Annotation | null) => void;
|
|
242
|
+
_setSelectedAnnotations?: (annotations: Array<Annotation>) => void;
|
|
243
243
|
}
|
|
244
244
|
export type AnnotationsUI<T extends Emitter> = T & AnnotationUI;
|
|
@@ -1,76 +1,76 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { Plugin, type Editor } from
|
|
10
|
-
import { Annotations } from
|
|
11
|
-
import { type Annotation } from
|
|
12
|
-
import { type AnnotationCollection } from
|
|
6
|
+
* @module comments/annotations/editorannotations
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin, type Editor, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
10
|
+
import { Annotations } from "./annotations.js";
|
|
11
|
+
import { type Annotation } from "./annotation.js";
|
|
12
|
+
import { type AnnotationCollection } from "./annotationcollection.js";
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
* Integrates {@link module:comments/annotations/annotations~Annotations annotations} with the editor to provide proper behavior
|
|
15
|
+
* for annotations created through the editor features.
|
|
16
|
+
*
|
|
17
|
+
* *Note: The API of this class might change in the near future.*
|
|
18
|
+
*
|
|
19
|
+
* Collects all types of the annotations created through the editor features and their markers and decides which annotation is currently
|
|
20
|
+
* selected by the selection.
|
|
21
|
+
*
|
|
22
|
+
* Every editor plugin that adds an annotation should also
|
|
23
|
+
* {@link module:comments/annotations/editorannotations~EditorAnnotations#addSourceCollector register a callback}
|
|
24
|
+
* in which it will check whether given annotation should be marked as selected.
|
|
25
|
+
*/
|
|
26
26
|
export declare class EditorAnnotations extends Plugin {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
static get requires(): PluginDependenciesOf<[Annotations]>;
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
34
|
+
static get pluginName(): "EditorAnnotations";
|
|
35
|
+
/**
|
|
36
|
+
* @inheritDoc
|
|
37
|
+
*/
|
|
38
|
+
static override get isOfficialPlugin(): true;
|
|
39
|
+
/**
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
static override get isPremiumPlugin(): true;
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
46
|
+
constructor(editor: Editor);
|
|
47
|
+
/**
|
|
48
|
+
* @inheritDoc
|
|
49
|
+
*/
|
|
50
|
+
init(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Registers given annotation as an editor annotation, that is an annotation that is linked with a target inside the editor content.
|
|
53
|
+
*/
|
|
54
|
+
registerAnnotation(annotation: Annotation): void;
|
|
55
|
+
hasDomSelection(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Registers a callback that collects annotations and their markers.
|
|
58
|
+
*/
|
|
59
|
+
addSourceCollector(callback: Function): void;
|
|
60
|
+
/**
|
|
61
|
+
* Finds all annotations selected by the editor selection and marks the most inner one as the active annotation.
|
|
62
|
+
*/
|
|
63
|
+
refreshSelectedViews(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Finds all annotations for selected markers in order from the most inner marker to the most outer marker.
|
|
66
|
+
*
|
|
67
|
+
* @param options Configuration options.
|
|
68
|
+
* @param options.annotations The collection of annotations for given UI.
|
|
69
|
+
* @param options.activeAnnotation The given UI active annotation.
|
|
70
|
+
* It is used to determine the order if the selection contains the active annotation's marker.
|
|
71
|
+
*/
|
|
72
|
+
getOrderedSelectedAnnotations({ activeAnnotation, annotations }: {
|
|
73
|
+
activeAnnotation: Annotation | null;
|
|
74
|
+
annotations: AnnotationCollection;
|
|
75
|
+
}): Array<Annotation>;
|
|
76
76
|
}
|