@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,94 +1,94 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module comments/annotations/annotationcollection
|
|
3
|
-
* @publicApi
|
|
4
|
-
*/
|
|
5
|
-
import { Collection } from 'ckeditor5/src/utils';
|
|
6
|
-
import type { View } from 'ckeditor5/src/ui';
|
|
7
|
-
import type Annotation from './annotation';
|
|
8
|
-
/**
|
|
9
|
-
* A collection of {@link module:comments/annotations/annotation~Annotation annotations}.
|
|
10
|
-
*
|
|
11
|
-
* It implements methods for managing annotations and creates a focus tracker for them to make it easier to manage
|
|
12
|
-
* the focus for all annotations.
|
|
13
|
-
*
|
|
14
|
-
* `AnnotationCollection` fires {@link module:comments/annotations/annotationcollection~AnnotationCollection#event:focus} when an annotation
|
|
15
|
-
* becomes focused and {@link module:comments/annotations/annotationcollection~AnnotationCollection#event:blur} when all annotations
|
|
16
|
-
* lose focus.
|
|
17
|
-
*/
|
|
18
|
-
export default class AnnotationCollection extends Collection<Annotation> {
|
|
19
|
-
/**
|
|
20
|
-
* @param annotations Initial annotations.
|
|
21
|
-
*/
|
|
22
|
-
constructor(annotations?: Iterable<Annotation>);
|
|
23
|
-
/**
|
|
24
|
-
* Equals to `true` when one of the annotation in the collection is focused.
|
|
25
|
-
*/
|
|
26
|
-
get isFocused(): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Adds an annotation to the collection.
|
|
29
|
-
*/
|
|
30
|
-
add(annotation: Annotation): this;
|
|
31
|
-
/**
|
|
32
|
-
* Removes the annotation from the collection.
|
|
33
|
-
*/
|
|
34
|
-
remove(annotation: Annotation): Annotation;
|
|
35
|
-
/**
|
|
36
|
-
* Gets the annotation for a given annotation view's inner view.
|
|
37
|
-
*/
|
|
38
|
-
getByInnerView(innerView: View): Annotation | undefined;
|
|
39
|
-
/**
|
|
40
|
-
* Gets the annotation for a given annotation view.
|
|
41
|
-
*/
|
|
42
|
-
getByView(view: View): Annotation | undefined;
|
|
43
|
-
/**
|
|
44
|
-
* Destroys all bindings and clears the collection.
|
|
45
|
-
*/
|
|
46
|
-
destroy(): void;
|
|
47
|
-
/**
|
|
48
|
-
* Refreshes the positioning of all annotations and sorts them topmost and leftmost.
|
|
49
|
-
*/
|
|
50
|
-
refreshPositioning(): void;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Fired when an annotation becomes active.
|
|
54
|
-
*
|
|
55
|
-
* @eventName ~AnnotationCollection#focus
|
|
56
|
-
* @param annotation An annotation that was focused.
|
|
57
|
-
*/
|
|
58
|
-
export type AnnotationFocusEvent = {
|
|
59
|
-
name: 'focus';
|
|
60
|
-
args: [annotation: Annotation];
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Fired when all annotations become blurred.
|
|
64
|
-
*
|
|
65
|
-
* @eventName ~AnnotationCollection#blur
|
|
66
|
-
*/
|
|
67
|
-
export type AnnotationBlurEvent = {
|
|
68
|
-
name: 'blur';
|
|
69
|
-
args: [];
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* A helper function that binds two {@link module:comments/annotations/annotationcollection~AnnotationCollection AnnotationCollection}s
|
|
73
|
-
* and allows filtering items based on the passed callback.
|
|
74
|
-
*
|
|
75
|
-
* Since {@link module:comments/annotations/annotationcollection~AnnotationCollection#refreshPositioning}
|
|
76
|
-
* sorts the annotations by removing and inserting items, the binding implemented by the `bindTo()` method is lost. This is why
|
|
77
|
-
* this helper needs to be used.
|
|
78
|
-
*
|
|
79
|
-
* This helper is used by the annotations UIs to filter which annotations from the
|
|
80
|
-
* {@link module:comments/annotations/annotations~Annotations#collection main annotation collection} should be handled by
|
|
81
|
-
* a given annotations UI.
|
|
82
|
-
*
|
|
83
|
-
* @param `options.source` The source collection
|
|
84
|
-
* from which the annotations will be taken.
|
|
85
|
-
* @param `options.target` The target collection
|
|
86
|
-
* that will be synced to the source collection.
|
|
87
|
-
* @param options.filter Filtering function that gets an annotation and should return `true` if the annotation should be
|
|
88
|
-
* copied to the `target` collection.
|
|
89
|
-
*/
|
|
90
|
-
export declare function bindAnnotationCollections({ source, target, filter }: {
|
|
91
|
-
source: AnnotationCollection;
|
|
92
|
-
target: AnnotationCollection;
|
|
93
|
-
filter: (annotation: Annotation) => boolean;
|
|
94
|
-
}): void;
|
|
1
|
+
/**
|
|
2
|
+
* @module comments/annotations/annotationcollection
|
|
3
|
+
* @publicApi
|
|
4
|
+
*/
|
|
5
|
+
import { Collection } from 'ckeditor5/src/utils';
|
|
6
|
+
import type { View } from 'ckeditor5/src/ui';
|
|
7
|
+
import type Annotation from './annotation';
|
|
8
|
+
/**
|
|
9
|
+
* A collection of {@link module:comments/annotations/annotation~Annotation annotations}.
|
|
10
|
+
*
|
|
11
|
+
* It implements methods for managing annotations and creates a focus tracker for them to make it easier to manage
|
|
12
|
+
* the focus for all annotations.
|
|
13
|
+
*
|
|
14
|
+
* `AnnotationCollection` fires {@link module:comments/annotations/annotationcollection~AnnotationCollection#event:focus} when an annotation
|
|
15
|
+
* becomes focused and {@link module:comments/annotations/annotationcollection~AnnotationCollection#event:blur} when all annotations
|
|
16
|
+
* lose focus.
|
|
17
|
+
*/
|
|
18
|
+
export default class AnnotationCollection extends Collection<Annotation> {
|
|
19
|
+
/**
|
|
20
|
+
* @param annotations Initial annotations.
|
|
21
|
+
*/
|
|
22
|
+
constructor(annotations?: Iterable<Annotation>);
|
|
23
|
+
/**
|
|
24
|
+
* Equals to `true` when one of the annotation in the collection is focused.
|
|
25
|
+
*/
|
|
26
|
+
get isFocused(): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Adds an annotation to the collection.
|
|
29
|
+
*/
|
|
30
|
+
add(annotation: Annotation): this;
|
|
31
|
+
/**
|
|
32
|
+
* Removes the annotation from the collection.
|
|
33
|
+
*/
|
|
34
|
+
remove(annotation: Annotation): Annotation;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the annotation for a given annotation view's inner view.
|
|
37
|
+
*/
|
|
38
|
+
getByInnerView(innerView: View): Annotation | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Gets the annotation for a given annotation view.
|
|
41
|
+
*/
|
|
42
|
+
getByView(view: View): Annotation | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Destroys all bindings and clears the collection.
|
|
45
|
+
*/
|
|
46
|
+
destroy(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Refreshes the positioning of all annotations and sorts them topmost and leftmost.
|
|
49
|
+
*/
|
|
50
|
+
refreshPositioning(): void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Fired when an annotation becomes active.
|
|
54
|
+
*
|
|
55
|
+
* @eventName ~AnnotationCollection#focus
|
|
56
|
+
* @param annotation An annotation that was focused.
|
|
57
|
+
*/
|
|
58
|
+
export type AnnotationFocusEvent = {
|
|
59
|
+
name: 'focus';
|
|
60
|
+
args: [annotation: Annotation];
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Fired when all annotations become blurred.
|
|
64
|
+
*
|
|
65
|
+
* @eventName ~AnnotationCollection#blur
|
|
66
|
+
*/
|
|
67
|
+
export type AnnotationBlurEvent = {
|
|
68
|
+
name: 'blur';
|
|
69
|
+
args: [];
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* A helper function that binds two {@link module:comments/annotations/annotationcollection~AnnotationCollection AnnotationCollection}s
|
|
73
|
+
* and allows filtering items based on the passed callback.
|
|
74
|
+
*
|
|
75
|
+
* Since {@link module:comments/annotations/annotationcollection~AnnotationCollection#refreshPositioning}
|
|
76
|
+
* sorts the annotations by removing and inserting items, the binding implemented by the `bindTo()` method is lost. This is why
|
|
77
|
+
* this helper needs to be used.
|
|
78
|
+
*
|
|
79
|
+
* This helper is used by the annotations UIs to filter which annotations from the
|
|
80
|
+
* {@link module:comments/annotations/annotations~Annotations#collection main annotation collection} should be handled by
|
|
81
|
+
* a given annotations UI.
|
|
82
|
+
*
|
|
83
|
+
* @param `options.source` The source collection
|
|
84
|
+
* from which the annotations will be taken.
|
|
85
|
+
* @param `options.target` The target collection
|
|
86
|
+
* that will be synced to the source collection.
|
|
87
|
+
* @param options.filter Filtering function that gets an annotation and should return `true` if the annotation should be
|
|
88
|
+
* copied to the `target` collection.
|
|
89
|
+
*/
|
|
90
|
+
export declare function bindAnnotationCollections({ source, target, filter }: {
|
|
91
|
+
source: AnnotationCollection;
|
|
92
|
+
target: AnnotationCollection;
|
|
93
|
+
filter: (annotation: Annotation) => boolean;
|
|
94
|
+
}): void;
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x32ea=['_getOrderInContent','_innerViewToAnnotation','remove','top','isFocused','fire','annotationcollection-not-existing-item','targetRect','destroy','blur','has','updateTargetRect','length','clear','getIndex','delete','getByInnerView','_sort','focusableElements','refreshPositioning','annotationcollection-duplicated-item','left','focusTracker','set','get','sort','view','from','innerView','listenTo','add','change:isFocused','_viewToAnnotation','stopListening','focus','_focusTracker','getByView'];(function(_0x124e3b,_0x32ea64){const _0x310ff0=function(_0x37bc59){while(--_0x37bc59){_0x124e3b['push'](_0x124e3b['shift']());}};_0x310ff0(++_0x32ea64);}(_0x32ea,0xb0));const _0x310f=function(_0x124e3b,_0x32ea64){_0x124e3b=_0x124e3b-0x0;let _0x310ff0=_0x32ea[_0x124e3b];return _0x310ff0;};import{CKEditorError as _0x5a6e77,Collection as _0x22193f,FocusTracker as _0x43fefe}from'ckeditor5/src/utils';export default class x extends _0x22193f{constructor(_0x3e3c73=[]){super(),this[_0x310f('0xa')]=new Map(),this[_0x310f('0x4')]=new Map(),this[_0x310f('0x7')]=new _0x43fefe(),this[_0x310f('0x7')]['on'](_0x310f('0x3'),(_0x388767,_0x57319f,_0x4b0f0f)=>{_0x4b0f0f||this[_0x310f('0xe')](_0x310f('0x12'));});for(const _0x3dfe11 of _0x3e3c73)this[_0x310f('0x2')](_0x3dfe11);}get[_0x310f('0xd')](){return this[_0x310f('0x7')][_0x310f('0xd')];}[_0x310f('0x2')](_0x40c375){if(this[_0x310f('0x13')](_0x40c375))throw new _0x5a6e77(_0x310f('0x1d'),null);this[_0x310f('0xa')][_0x310f('0x20')](_0x40c375[_0x310f('0x0')],_0x40c375),this[_0x310f('0x4')][_0x310f('0x20')](_0x40c375[_0x310f('0x23')],_0x40c375);for(const _0x2b4983 of _0x40c375[_0x310f('0x1b')])this[_0x310f('0x7')]['add'](_0x2b4983);this[_0x310f('0x1')](_0x40c375[_0x310f('0x1b')],'add',(_0x43995c,_0x3976d5)=>{this['_focusTracker'][_0x310f('0x2')](_0x3976d5);}),this[_0x310f('0x1')](_0x40c375[_0x310f('0x1b')],_0x310f('0xb'),(_0x1489d8,_0x494b9c)=>{this['_focusTracker'][_0x310f('0xb')](_0x494b9c);}),this[_0x310f('0x1')](_0x40c375[_0x310f('0x23')][_0x310f('0x1f')],_0x310f('0x3'),(_0x9fe4bf,_0x2aeedc,_0x21510c)=>{_0x21510c&&this[_0x310f('0xe')](_0x310f('0x6'),_0x40c375);}),_0x40c375[_0x310f('0x14')]();const _0x575fb6=this[_0x310f('0x9')](_0x40c375[_0x310f('0x23')][_0x310f('0x10')]);return super[_0x310f('0x2')](_0x40c375,_0x575fb6);}[_0x310f('0xb')](_0x8ebe37){if(!this[_0x310f('0x13')](_0x8ebe37))throw new _0x5a6e77(_0x310f('0xf'),null);this[_0x310f('0x5')](_0x8ebe37['view'][_0x310f('0x1f')]),this[_0x310f('0x5')](_0x8ebe37[_0x310f('0x1b')]);for(const _0x412990 of _0x8ebe37['focusableElements'])this[_0x310f('0x7')][_0x310f('0xb')](_0x412990);return this[_0x310f('0x4')][_0x310f('0x18')](_0x8ebe37[_0x310f('0x23')]),this[_0x310f('0xa')][_0x310f('0x18')](_0x8ebe37[_0x310f('0x0')]),super[_0x310f('0xb')](_0x8ebe37);}[_0x310f('0x19')](_0x223d1a){return this[_0x310f('0xa')][_0x310f('0x21')](_0x223d1a);}[_0x310f('0x8')](_0x2bd6a){return this[_0x310f('0x4')]['get'](_0x2bd6a);}[_0x310f('0x11')](){super[_0x310f('0x16')](),this[_0x310f('0x5')](),this[_0x310f('0xa')][_0x310f('0x16')](),this['_viewToAnnotation'][_0x310f('0x16')](),this[_0x310f('0x7')]['destroy']();}[_0x310f('0x1c')](){for(const _0x3de194 of this)_0x3de194[_0x310f('0x14')]();this[_0x310f('0x1a')]();}[_0x310f('0x1a')](){const _0x4a79b3=Array[_0x310f('0x24')](this)[_0x310f('0x22')]((_0x356082,_0x1e6338)=>v(_0x356082[_0x310f('0x23')][_0x310f('0x10')],_0x1e6338[_0x310f('0x23')]['targetRect']));for(let _0x19d0e8=_0x4a79b3[_0x310f('0x15')]-0x1;_0x19d0e8>0x0;_0x19d0e8--){const _0x433bbc=_0x4a79b3[_0x19d0e8];_0x19d0e8!==this[_0x310f('0x17')](_0x433bbc)&&(this['remove'](_0x433bbc),this['add'](_0x433bbc));}}['_getOrderInContent'](_0x3d8f63){let _0x34a625=0x0;if(!_0x3d8f63)return this[_0x310f('0x15')];for(const _0x4452a8 of this){const _0x47b833=_0x4452a8[_0x310f('0x23')]['targetRect'];if(_0x47b833){if(v(_0x3d8f63,_0x47b833)<0x0)return _0x34a625;_0x34a625++;}}return _0x34a625;}}export function bindAnnotationCollections({source:_0x7ed3f,target:_0x2b705a,filter:_0x53b583}){for(const _0x2a7988 of _0x7ed3f)_0x53b583(_0x2a7988)&&_0x2b705a['add'](_0x2a7988);_0x2b705a[_0x310f('0x1')](_0x7ed3f,_0x310f('0x2'),(_0x1276c4,_0x4c1cef)=>{_0x53b583(_0x4c1cef)&&_0x2b705a[_0x310f('0x2')](_0x4c1cef);}),_0x2b705a['listenTo'](_0x7ed3f,_0x310f('0xb'),(_0x11cff3,_0x59e1f3)=>{_0x2b705a['has'](_0x59e1f3)&&_0x2b705a[_0x310f('0xb')](_0x59e1f3);});}function v(_0x1aae34,_0x144936){if(null===_0x1aae34&&null===_0x144936)return 0x0;if(null===_0x1aae34)return-0x1;if(null===_0x144936)return 0x1;const _0x12c845=_0x1aae34[_0x310f('0xc')]-_0x144936[_0x310f('0xc')];return 0x0==_0x12c845?_0x1aae34[_0x310f('0x1e')]-_0x144936['left']:_0x12c845;}
|
|
@@ -1,150 +1,150 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module comments/annotations/annotations
|
|
3
|
-
* @publicApi
|
|
4
|
-
*/
|
|
5
|
-
import { ContextPlugin, type Context, type Editor } from 'ckeditor5/src/core';
|
|
6
|
-
import type { View } from 'ckeditor5/src/ui';
|
|
7
|
-
import { type Locale } from 'ckeditor5/src/utils';
|
|
8
|
-
import Annotation, { type AnnotationTarget } from './annotation';
|
|
9
|
-
import AnnotationCollection from './annotationcollection';
|
|
10
|
-
import AnnotationView, { type AnnotationMainView } from './view/annotationview';
|
|
11
|
-
/**
|
|
12
|
-
* Stores and manages all {@link module:comments/annotations/annotation~Annotation annotations} created
|
|
13
|
-
* for the entire {@link module:core/context~Context} or {@link module:core/editor/editor~Editor}.
|
|
14
|
-
*
|
|
15
|
-
* It allows for {@link module:comments/annotations/annotations~Annotations#add adding} and
|
|
16
|
-
* {@link module:comments/annotations/annotations~Annotations#remove removing} annotations.
|
|
17
|
-
*
|
|
18
|
-
* It manages {@link module:comments/annotations/annotations~Annotations#activate activating} and
|
|
19
|
-
* {@link module:comments/annotations/annotations~Annotations#deactivateAll deactivating} annotations. Using those methods will
|
|
20
|
-
* result in setting {@link module:comments/annotations/annotationsuis~AnnotationUI#activeAnnotation} in the appropriate
|
|
21
|
-
* {@link module:comments/annotations/annotationsuis~AnnotationsUI annotations UI} plugins.
|
|
22
|
-
*
|
|
23
|
-
* All active annotations are stored in {@link module:comments/annotations/annotations~Annotations#activeAnnotations}.
|
|
24
|
-
*
|
|
25
|
-
* `Annotations` is linked with {@link module:comments/annotations/annotationsuis~AnnotationsUIs}, which listens to events fired by
|
|
26
|
-
* `Annotations` and propagates information to and from annotations UI plugins.
|
|
27
|
-
*/
|
|
28
|
-
export default class Annotations extends ContextPlugin {
|
|
29
|
-
/**
|
|
30
|
-
* A set of currently active annotations.
|
|
31
|
-
*
|
|
32
|
-
* @observable
|
|
33
|
-
*/
|
|
34
|
-
activeAnnotations: Set<Annotation>;
|
|
35
|
-
/**
|
|
36
|
-
* A collection of all annotations. It should not be operated on directly.
|
|
37
|
-
*/
|
|
38
|
-
readonly collection: AnnotationCollection;
|
|
39
|
-
/**
|
|
40
|
-
* @inheritDoc
|
|
41
|
-
*/
|
|
42
|
-
static get pluginName():
|
|
43
|
-
/**
|
|
44
|
-
* @inheritDoc
|
|
45
|
-
*/
|
|
46
|
-
constructor(context: Context | Editor);
|
|
47
|
-
/**
|
|
48
|
-
* Adds an annotation to the collection.
|
|
49
|
-
*/
|
|
50
|
-
add(annotation: Annotation): void;
|
|
51
|
-
/**
|
|
52
|
-
* Removes the given annotation from the collection.
|
|
53
|
-
*/
|
|
54
|
-
remove(annotation: Annotation): void;
|
|
55
|
-
/**
|
|
56
|
-
* Refreshes the visibility of annotations based on the visibility of their annotation targets.
|
|
57
|
-
*
|
|
58
|
-
* This method should be called when one or more annotations' targets changed their visibility,
|
|
59
|
-
* for example when one of the editors was shown or hidden.
|
|
60
|
-
*
|
|
61
|
-
* This method recalculates all annotations' {@link module:comments/annotations/annotation~Annotation#isVisible `isVisible`} property.
|
|
62
|
-
*/
|
|
63
|
-
refreshVisibility(): void;
|
|
64
|
-
/**
|
|
65
|
-
* Refreshes the positioning of all visible annotations and sorts them topmost and leftmost.
|
|
66
|
-
*/
|
|
67
|
-
refreshPositioning(): void;
|
|
68
|
-
/**
|
|
69
|
-
* Returns the annotation that "contains" the given annotation view's inner view.
|
|
70
|
-
*/
|
|
71
|
-
getByInnerView(innerView: View): Annotation | undefined;
|
|
72
|
-
/**
|
|
73
|
-
* Deactivates all active annotations.
|
|
74
|
-
*
|
|
75
|
-
* @fires _deactivateAllAnnotations
|
|
76
|
-
*/
|
|
77
|
-
deactivateAll(): void;
|
|
78
|
-
/**
|
|
79
|
-
* @inheritDoc
|
|
80
|
-
*/
|
|
81
|
-
destroy(): void;
|
|
82
|
-
/**
|
|
83
|
-
* Activates the given annotation.
|
|
84
|
-
*
|
|
85
|
-
* If annotations UI that handles the given annotation already has an active annotation,
|
|
86
|
-
* then it deactivates it and activates the provided one.
|
|
87
|
-
*
|
|
88
|
-
* @fires _activateAnnotation
|
|
89
|
-
*/
|
|
90
|
-
activate(annotation: Annotation): void;
|
|
91
|
-
/**
|
|
92
|
-
* Creates an annotation.
|
|
93
|
-
*
|
|
94
|
-
* ```ts
|
|
95
|
-
* const annotationView = annotations.createAnnotationView( editor.locale, innerView );
|
|
96
|
-
*
|
|
97
|
-
* const annotation = annotations.createAnnotation( {
|
|
98
|
-
* view: annotationView,
|
|
99
|
-
* target: document.getElementById( 'target' ),
|
|
100
|
-
* type: 'comment'
|
|
101
|
-
* } );
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* @returns An annotation.
|
|
105
|
-
*/
|
|
106
|
-
createAnnotation(options: AnnotationOptions): Annotation;
|
|
107
|
-
/**
|
|
108
|
-
* Creates an annotation view wrapper for the annotation content.
|
|
109
|
-
*
|
|
110
|
-
* ```ts
|
|
111
|
-
* const innerView = createCustomView();
|
|
112
|
-
* const annotationView = annotations.createAnnotationView( editor.locale, innerView );
|
|
113
|
-
* ```
|
|
114
|
-
*
|
|
115
|
-
* @returns An annotation view.
|
|
116
|
-
*/
|
|
117
|
-
createAnnotationView(locale: Locale, view: AnnotationMainView): AnnotationView;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* The configuration options which are used to create new {@link module:comments/annotations/annotation~Annotation annotations}.
|
|
121
|
-
*
|
|
122
|
-
* @param view The annotation view.
|
|
123
|
-
* @param target The annotation target.
|
|
124
|
-
* @param type The annotation type.
|
|
125
|
-
* @param isVisible The initial visibility of the annotation.
|
|
126
|
-
*/
|
|
127
|
-
export interface AnnotationOptions {
|
|
128
|
-
view: AnnotationView;
|
|
129
|
-
target: AnnotationTarget;
|
|
130
|
-
type: string | (() => string);
|
|
131
|
-
isVisible?: boolean;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* An internal event that fires when the annotation should be activated.
|
|
135
|
-
*
|
|
136
|
-
* @eventName ~Annotations#_activateAnnotation
|
|
137
|
-
*/
|
|
138
|
-
export type ActivateAnnotationEvent = {
|
|
139
|
-
name: '_activateAnnotation';
|
|
140
|
-
args: [annotation: Annotation];
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* An internal event that fires when all annotations should be deactivated.
|
|
144
|
-
*
|
|
145
|
-
* @eventName ~Annotations#_deactivateAllAnnotations
|
|
146
|
-
*/
|
|
147
|
-
export type DeactivateAllAnnotationsEvent = {
|
|
148
|
-
name: '_deactivateAllAnnotations';
|
|
149
|
-
args: [];
|
|
150
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* @module comments/annotations/annotations
|
|
3
|
+
* @publicApi
|
|
4
|
+
*/
|
|
5
|
+
import { ContextPlugin, type Context, type Editor } from 'ckeditor5/src/core';
|
|
6
|
+
import type { View } from 'ckeditor5/src/ui';
|
|
7
|
+
import { type Locale } from 'ckeditor5/src/utils';
|
|
8
|
+
import Annotation, { type AnnotationTarget } from './annotation';
|
|
9
|
+
import AnnotationCollection from './annotationcollection';
|
|
10
|
+
import AnnotationView, { type AnnotationMainView } from './view/annotationview';
|
|
11
|
+
/**
|
|
12
|
+
* Stores and manages all {@link module:comments/annotations/annotation~Annotation annotations} created
|
|
13
|
+
* for the entire {@link module:core/context~Context} or {@link module:core/editor/editor~Editor}.
|
|
14
|
+
*
|
|
15
|
+
* It allows for {@link module:comments/annotations/annotations~Annotations#add adding} and
|
|
16
|
+
* {@link module:comments/annotations/annotations~Annotations#remove removing} annotations.
|
|
17
|
+
*
|
|
18
|
+
* It manages {@link module:comments/annotations/annotations~Annotations#activate activating} and
|
|
19
|
+
* {@link module:comments/annotations/annotations~Annotations#deactivateAll deactivating} annotations. Using those methods will
|
|
20
|
+
* result in setting {@link module:comments/annotations/annotationsuis~AnnotationUI#activeAnnotation} in the appropriate
|
|
21
|
+
* {@link module:comments/annotations/annotationsuis~AnnotationsUI annotations UI} plugins.
|
|
22
|
+
*
|
|
23
|
+
* All active annotations are stored in {@link module:comments/annotations/annotations~Annotations#activeAnnotations}.
|
|
24
|
+
*
|
|
25
|
+
* `Annotations` is linked with {@link module:comments/annotations/annotationsuis~AnnotationsUIs}, which listens to events fired by
|
|
26
|
+
* `Annotations` and propagates information to and from annotations UI plugins.
|
|
27
|
+
*/
|
|
28
|
+
export default class Annotations extends ContextPlugin {
|
|
29
|
+
/**
|
|
30
|
+
* A set of currently active annotations.
|
|
31
|
+
*
|
|
32
|
+
* @observable
|
|
33
|
+
*/
|
|
34
|
+
activeAnnotations: Set<Annotation>;
|
|
35
|
+
/**
|
|
36
|
+
* A collection of all annotations. It should not be operated on directly.
|
|
37
|
+
*/
|
|
38
|
+
readonly collection: AnnotationCollection;
|
|
39
|
+
/**
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
static get pluginName(): "Annotations";
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
46
|
+
constructor(context: Context | Editor);
|
|
47
|
+
/**
|
|
48
|
+
* Adds an annotation to the collection.
|
|
49
|
+
*/
|
|
50
|
+
add(annotation: Annotation): void;
|
|
51
|
+
/**
|
|
52
|
+
* Removes the given annotation from the collection.
|
|
53
|
+
*/
|
|
54
|
+
remove(annotation: Annotation): void;
|
|
55
|
+
/**
|
|
56
|
+
* Refreshes the visibility of annotations based on the visibility of their annotation targets.
|
|
57
|
+
*
|
|
58
|
+
* This method should be called when one or more annotations' targets changed their visibility,
|
|
59
|
+
* for example when one of the editors was shown or hidden.
|
|
60
|
+
*
|
|
61
|
+
* This method recalculates all annotations' {@link module:comments/annotations/annotation~Annotation#isVisible `isVisible`} property.
|
|
62
|
+
*/
|
|
63
|
+
refreshVisibility(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Refreshes the positioning of all visible annotations and sorts them topmost and leftmost.
|
|
66
|
+
*/
|
|
67
|
+
refreshPositioning(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Returns the annotation that "contains" the given annotation view's inner view.
|
|
70
|
+
*/
|
|
71
|
+
getByInnerView(innerView: View): Annotation | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Deactivates all active annotations.
|
|
74
|
+
*
|
|
75
|
+
* @fires _deactivateAllAnnotations
|
|
76
|
+
*/
|
|
77
|
+
deactivateAll(): void;
|
|
78
|
+
/**
|
|
79
|
+
* @inheritDoc
|
|
80
|
+
*/
|
|
81
|
+
destroy(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Activates the given annotation.
|
|
84
|
+
*
|
|
85
|
+
* If annotations UI that handles the given annotation already has an active annotation,
|
|
86
|
+
* then it deactivates it and activates the provided one.
|
|
87
|
+
*
|
|
88
|
+
* @fires _activateAnnotation
|
|
89
|
+
*/
|
|
90
|
+
activate(annotation: Annotation): void;
|
|
91
|
+
/**
|
|
92
|
+
* Creates an annotation.
|
|
93
|
+
*
|
|
94
|
+
* ```ts
|
|
95
|
+
* const annotationView = annotations.createAnnotationView( editor.locale, innerView );
|
|
96
|
+
*
|
|
97
|
+
* const annotation = annotations.createAnnotation( {
|
|
98
|
+
* view: annotationView,
|
|
99
|
+
* target: document.getElementById( 'target' ),
|
|
100
|
+
* type: 'comment'
|
|
101
|
+
* } );
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @returns An annotation.
|
|
105
|
+
*/
|
|
106
|
+
createAnnotation(options: AnnotationOptions): Annotation;
|
|
107
|
+
/**
|
|
108
|
+
* Creates an annotation view wrapper for the annotation content.
|
|
109
|
+
*
|
|
110
|
+
* ```ts
|
|
111
|
+
* const innerView = createCustomView();
|
|
112
|
+
* const annotationView = annotations.createAnnotationView( editor.locale, innerView );
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @returns An annotation view.
|
|
116
|
+
*/
|
|
117
|
+
createAnnotationView(locale: Locale, view: AnnotationMainView): AnnotationView;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The configuration options which are used to create new {@link module:comments/annotations/annotation~Annotation annotations}.
|
|
121
|
+
*
|
|
122
|
+
* @param view The annotation view.
|
|
123
|
+
* @param target The annotation target.
|
|
124
|
+
* @param type The annotation type.
|
|
125
|
+
* @param isVisible The initial visibility of the annotation.
|
|
126
|
+
*/
|
|
127
|
+
export interface AnnotationOptions {
|
|
128
|
+
view: AnnotationView;
|
|
129
|
+
target: AnnotationTarget;
|
|
130
|
+
type: string | (() => string);
|
|
131
|
+
isVisible?: boolean;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* An internal event that fires when the annotation should be activated.
|
|
135
|
+
*
|
|
136
|
+
* @eventName ~Annotations#_activateAnnotation
|
|
137
|
+
*/
|
|
138
|
+
export type ActivateAnnotationEvent = {
|
|
139
|
+
name: '_activateAnnotation';
|
|
140
|
+
args: [annotation: Annotation];
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* An internal event that fires when all annotations should be deactivated.
|
|
144
|
+
*
|
|
145
|
+
* @eventName ~Annotations#_deactivateAllAnnotations
|
|
146
|
+
*/
|
|
147
|
+
export type DeactivateAllAnnotationsEvent = {
|
|
148
|
+
name: '_deactivateAllAnnotations';
|
|
149
|
+
args: [];
|
|
150
|
+
};
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0xab17=['focusTracker','_removeActiveAnnotation','change:isVisible','_deactivateAllAnnotations','createAnnotation','pluginName','createAnnotationView','set','isVisible','getByInnerView','refreshPositioning','element','deactivateAll','listenTo','_activateAnnotation','collection','Annotations','add','delete','fire','view','remove','refreshVisibility','has','_bindAnnotationsToVisibleAnnotations','destroy','source','_addActiveAnnotation','activeAnnotations','_visibleAnnotations'];(function(_0x5c9264,_0xab1730){const _0x50b19e=function(_0x3e96c2){while(--_0x3e96c2){_0x5c9264['push'](_0x5c9264['shift']());}};_0x50b19e(++_0xab1730);}(_0xab17,0x1e9));const _0x50b1=function(_0x5c9264,_0xab1730){_0x5c9264=_0x5c9264-0x0;let _0x50b19e=_0xab17[_0x5c9264];return _0x50b19e;};import{ContextPlugin as _0x51097d}from'ckeditor5/src/core';import _0x43ff16 from'./annotation';import _0x1d4d19 from'./annotationcollection';import _0x260d34 from'./view/annotationview';export default class b extends _0x51097d{static get[_0x50b1('0x1a')](){return _0x50b1('0x7');}constructor(_0x285e48){super(_0x285e48),this[_0x50b1('0x6')]=new _0x1d4d19(),this['_visibleAnnotations']=new _0x1d4d19(),this[_0x50b1('0x1c')]('activeAnnotations',new Set()),this[_0x50b1('0xf')]();}[_0x50b1('0x8')](_0x48de32){this['collection'][_0x50b1('0x8')](_0x48de32);}[_0x50b1('0xc')](_0x3700b3){this[_0x50b1('0x6')][_0x50b1('0xc')](_0x3700b3),_0x3700b3[_0x50b1('0x10')]();}[_0x50b1('0xd')](){for(const _0x1ffcd9 of this[_0x50b1('0x6')])_0x1ffcd9[_0x50b1('0xd')]();}[_0x50b1('0x1')](){this['_visibleAnnotations'][_0x50b1('0x1')]();}[_0x50b1('0x0')](_0xc1330e){return this[_0x50b1('0x6')]['getByInnerView'](_0xc1330e);}[_0x50b1('0x3')](){this[_0x50b1('0xa')](_0x50b1('0x18'));}[_0x50b1('0x10')](){for(const _0x1b3e2a of this['collection'])_0x1b3e2a['destroy']();this['_visibleAnnotations'][_0x50b1('0x10')](),this[_0x50b1('0x6')]['destroy'](),super[_0x50b1('0x10')]();}['activate'](_0x2813a6){this[_0x50b1('0xa')](_0x50b1('0x5'),_0x2813a6);}[_0x50b1('0x19')](_0x2736ac){return new _0x43ff16(_0x2736ac);}[_0x50b1('0x1b')](_0x5a0c97,_0x1f7176){return new _0x260d34(_0x5a0c97,_0x1f7176);}[_0x50b1('0x12')](_0x3fb498){const _0x147848=new Set(this[_0x50b1('0x13')]);_0x147848[_0x50b1('0x8')](_0x3fb498),this[_0x50b1('0x13')]=_0x147848;}[_0x50b1('0x16')](_0x57b9c4){const _0x24b807=new Set(this['activeAnnotations']);_0x24b807[_0x50b1('0x9')](_0x57b9c4),this['activeAnnotations']=_0x24b807;}[_0x50b1('0xf')](){const _0x5f03e1=this[_0x50b1('0x6')],_0x383016=this[_0x50b1('0x14')];function _0x5f0b7e(_0x471d4f){const _0x50aae7=_0x471d4f[_0x50b1('0x11')];_0x50aae7[_0x50b1('0x1d')]&&!_0x383016[_0x50b1('0xe')](_0x50aae7)?_0x383016[_0x50b1('0x8')](_0x50aae7):!_0x50aae7[_0x50b1('0x1d')]&&_0x383016[_0x50b1('0xe')](_0x50aae7)&&_0x383016[_0x50b1('0xc')](_0x50aae7),_0x50aae7[_0x50b1('0xb')][_0x50b1('0x15')][_0x50b1('0xc')](_0x50aae7[_0x50b1('0xb')][_0x50b1('0x2')]),_0x50aae7['view'][_0x50b1('0x15')]['add'](_0x50aae7[_0x50b1('0xb')][_0x50b1('0x2')]);}this[_0x50b1('0x4')](_0x5f03e1,_0x50b1('0x8'),(_0x402504,_0x3c9708)=>{_0x3c9708['isVisible']&&_0x383016[_0x50b1('0x8')](_0x3c9708),this[_0x50b1('0x4')](_0x3c9708,'change:isVisible',_0x5f0b7e);}),this[_0x50b1('0x4')](_0x5f03e1,_0x50b1('0xc'),(_0x3b0e29,_0x1d8716)=>{_0x383016[_0x50b1('0xe')](_0x1d8716)&&_0x383016['remove'](_0x1d8716),this['stopListening'](_0x1d8716,_0x50b1('0x17'),_0x5f0b7e);});}}
|