@ckeditor/ckeditor5-comments 38.1.1 → 38.2.0-alpha.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/package.json +4 -3
- 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 -228
- package/src/annotations/annotationsuis.js +1 -1
- package/src/annotations/editorannotations.d.ts +63 -63
- package/src/annotations/editorannotations.js +1 -1
- package/src/annotations/inlineannotations.d.ts +86 -86
- package/src/annotations/inlineannotations.js +1 -1
- package/src/annotations/narrowsidebar.d.ts +81 -81
- 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 -73
- 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 -27
- package/src/comments/commentsarchive.js +1 -1
- package/src/comments/commentsarchiveui.d.ts +34 -34
- package/src/comments/commentsarchiveui.js +1 -1
- package/src/comments/commentsediting.d.ts +75 -75
- package/src/comments/commentsediting.js +1 -1
- package/src/comments/commentsrepository.d.ts +1088 -1088
- package/src/comments/commentsrepository.js +1 -1
- package/src/comments/commentsui.d.ts +29 -29
- 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 -31
- package/src/comments.js +1 -1
- package/src/commentsonly.d.ts +29 -29
- package/src/commentsonly.js +1 -1
- package/src/config.d.ts +172 -172
- package/src/index.d.ts +21 -21
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-comments",
|
|
3
|
-
"version": "38.
|
|
3
|
+
"version": "38.2.0-alpha.1",
|
|
4
4
|
"description": "Collaborative comments feature for CKEditor 5.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"discussions"
|
|
34
34
|
],
|
|
35
35
|
"main": "src/index.js",
|
|
36
|
+
"type": "module",
|
|
36
37
|
"files": [
|
|
37
38
|
"build",
|
|
38
39
|
"lang",
|
|
@@ -43,8 +44,8 @@
|
|
|
43
44
|
"CHANGELOG.md"
|
|
44
45
|
],
|
|
45
46
|
"dependencies": {
|
|
46
|
-
"ckeditor5": "38.
|
|
47
|
-
"ckeditor5-collaboration": "38.
|
|
47
|
+
"ckeditor5": "38.2.0-alpha.1",
|
|
48
|
+
"ckeditor5-collaboration": "38.2.0-alpha.1",
|
|
48
49
|
"lodash-es": "^4.17.11"
|
|
49
50
|
},
|
|
50
51
|
"engines": {
|
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module comments/annotations/annotation
|
|
3
|
-
* @publicApi
|
|
4
|
-
*/
|
|
5
|
-
import { Rect, Collection } from 'ckeditor5/src/utils';
|
|
6
|
-
import type { View } from 'ckeditor5/src/ui';
|
|
7
|
-
import type AnnotationView from './view/annotationview';
|
|
8
|
-
import type { AnnotationOptions } from './annotations';
|
|
9
|
-
declare const Annotation_base: {
|
|
10
|
-
new (): import("ckeditor5/src/utils").Observable;
|
|
11
|
-
prototype: import("ckeditor5/src/utils").Observable;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Represents an annotation.
|
|
15
|
-
*
|
|
16
|
-
* Annotation is an entity that combines an {@link module:comments/annotations/view/annotationview~AnnotationView}
|
|
17
|
-
* and an annotation target (a DOM element or a {@link module:utils/dom/rect~Rect}) to which the annotation is bound.
|
|
18
|
-
*/
|
|
19
|
-
export default class Annotation extends Annotation_base {
|
|
20
|
-
/**
|
|
21
|
-
* The visibility of the annotation. Annotations that are not visible, are filtered from Annotation UI collections.
|
|
22
|
-
*
|
|
23
|
-
* @observable
|
|
24
|
-
*/
|
|
25
|
-
isVisible: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* The annotation view.
|
|
28
|
-
*/
|
|
29
|
-
view: AnnotationView;
|
|
30
|
-
/**
|
|
31
|
-
* A collection of DOM elements which, when focused, make the annotation active.
|
|
32
|
-
*
|
|
33
|
-
* By default, this collection only contains the annotation view element.
|
|
34
|
-
* It can be extended with custom targets that will be tracked by the annotation focus tracking system.
|
|
35
|
-
*/
|
|
36
|
-
focusableElements: Collection<HTMLElement>;
|
|
37
|
-
/**
|
|
38
|
-
* Creates an instance of the {@link module:comments/annotations/annotation~Annotation}.
|
|
39
|
-
*/
|
|
40
|
-
constructor({ view, target, type, isVisible }: AnnotationOptions);
|
|
41
|
-
/**
|
|
42
|
-
* The type of the annotation.
|
|
43
|
-
*/
|
|
44
|
-
get type(): string;
|
|
45
|
-
/**
|
|
46
|
-
* The annotation inner view.
|
|
47
|
-
*
|
|
48
|
-
* It is the view that is wrapped by the annotation view.*
|
|
49
|
-
*/
|
|
50
|
-
get innerView(): View;
|
|
51
|
-
/**
|
|
52
|
-
* The annotation target to which the annotation view should be pinned.
|
|
53
|
-
*
|
|
54
|
-
* It can be an array of DOM elements or {@link module:utils/dom/rect~Rect a rect instance} or `null`.
|
|
55
|
-
*/
|
|
56
|
-
get target(): Rect | Array<HTMLElement> | null;
|
|
57
|
-
/**
|
|
58
|
-
* The position and dimensions of the annotation target to which the annotation is bound.
|
|
59
|
-
*/
|
|
60
|
-
get targetRect(): Rect | null;
|
|
61
|
-
/**
|
|
62
|
-
* The state of the annotation.
|
|
63
|
-
*/
|
|
64
|
-
get isActive(): boolean;
|
|
65
|
-
set isActive(value: boolean);
|
|
66
|
-
/**
|
|
67
|
-
* Updates the target rect in the annotation view instance.
|
|
68
|
-
*/
|
|
69
|
-
updateTargetRect(): void;
|
|
70
|
-
/**
|
|
71
|
-
* Clears all event listeners and internal collections.
|
|
72
|
-
*/
|
|
73
|
-
destroy(): void;
|
|
74
|
-
/**
|
|
75
|
-
* Refreshes the visibility of the annotation based on the visibility of the annotation target.
|
|
76
|
-
*
|
|
77
|
-
* It sets the {@link #isVisible} property when the target is not attached to DOM or if the target or its descendant has
|
|
78
|
-
* set the `display` attribute to `none`.
|
|
79
|
-
*
|
|
80
|
-
* This method only updates an annotation if the annotation target is an HTML Element.
|
|
81
|
-
*/
|
|
82
|
-
refreshVisibility(): void;
|
|
83
|
-
}
|
|
84
|
-
type Target = Rect | HTMLElement | null;
|
|
85
|
-
export type AnnotationTarget = Target | (() => Target | Array<Target>);
|
|
86
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* @module comments/annotations/annotation
|
|
3
|
+
* @publicApi
|
|
4
|
+
*/
|
|
5
|
+
import { Rect, Collection } from 'ckeditor5/src/utils.js';
|
|
6
|
+
import type { View } from 'ckeditor5/src/ui.js';
|
|
7
|
+
import type AnnotationView from './view/annotationview.js';
|
|
8
|
+
import type { AnnotationOptions } from './annotations.js';
|
|
9
|
+
declare const Annotation_base: {
|
|
10
|
+
new (): import("ckeditor5/src/utils.js").Observable;
|
|
11
|
+
prototype: import("ckeditor5/src/utils.js").Observable;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Represents an annotation.
|
|
15
|
+
*
|
|
16
|
+
* Annotation is an entity that combines an {@link module:comments/annotations/view/annotationview~AnnotationView}
|
|
17
|
+
* and an annotation target (a DOM element or a {@link module:utils/dom/rect~Rect}) to which the annotation is bound.
|
|
18
|
+
*/
|
|
19
|
+
export default class Annotation extends Annotation_base {
|
|
20
|
+
/**
|
|
21
|
+
* The visibility of the annotation. Annotations that are not visible, are filtered from Annotation UI collections.
|
|
22
|
+
*
|
|
23
|
+
* @observable
|
|
24
|
+
*/
|
|
25
|
+
isVisible: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The annotation view.
|
|
28
|
+
*/
|
|
29
|
+
view: AnnotationView;
|
|
30
|
+
/**
|
|
31
|
+
* A collection of DOM elements which, when focused, make the annotation active.
|
|
32
|
+
*
|
|
33
|
+
* By default, this collection only contains the annotation view element.
|
|
34
|
+
* It can be extended with custom targets that will be tracked by the annotation focus tracking system.
|
|
35
|
+
*/
|
|
36
|
+
focusableElements: Collection<HTMLElement>;
|
|
37
|
+
/**
|
|
38
|
+
* Creates an instance of the {@link module:comments/annotations/annotation~Annotation}.
|
|
39
|
+
*/
|
|
40
|
+
constructor({ view, target, type, isVisible }: AnnotationOptions);
|
|
41
|
+
/**
|
|
42
|
+
* The type of the annotation.
|
|
43
|
+
*/
|
|
44
|
+
get type(): string;
|
|
45
|
+
/**
|
|
46
|
+
* The annotation inner view.
|
|
47
|
+
*
|
|
48
|
+
* It is the view that is wrapped by the annotation view.*
|
|
49
|
+
*/
|
|
50
|
+
get innerView(): View;
|
|
51
|
+
/**
|
|
52
|
+
* The annotation target to which the annotation view should be pinned.
|
|
53
|
+
*
|
|
54
|
+
* It can be an array of DOM elements or {@link module:utils/dom/rect~Rect a rect instance} or `null`.
|
|
55
|
+
*/
|
|
56
|
+
get target(): Rect | Array<HTMLElement> | null;
|
|
57
|
+
/**
|
|
58
|
+
* The position and dimensions of the annotation target to which the annotation is bound.
|
|
59
|
+
*/
|
|
60
|
+
get targetRect(): Rect | null;
|
|
61
|
+
/**
|
|
62
|
+
* The state of the annotation.
|
|
63
|
+
*/
|
|
64
|
+
get isActive(): boolean;
|
|
65
|
+
set isActive(value: boolean);
|
|
66
|
+
/**
|
|
67
|
+
* Updates the target rect in the annotation view instance.
|
|
68
|
+
*/
|
|
69
|
+
updateTargetRect(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Clears all event listeners and internal collections.
|
|
72
|
+
*/
|
|
73
|
+
destroy(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Refreshes the visibility of the annotation based on the visibility of the annotation target.
|
|
76
|
+
*
|
|
77
|
+
* It sets the {@link #isVisible} property when the target is not attached to DOM or if the target or its descendant has
|
|
78
|
+
* set the `display` attribute to `none`.
|
|
79
|
+
*
|
|
80
|
+
* This method only updates an annotation if the annotation target is an HTML Element.
|
|
81
|
+
*/
|
|
82
|
+
refreshVisibility(): void;
|
|
83
|
+
}
|
|
84
|
+
type Target = Rect | HTMLElement | null;
|
|
85
|
+
export type AnnotationTarget = Target | (() => Target | Array<Target>);
|
|
86
|
+
export {};
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x7d4a=['annotation-invalid-target','view','set','focusableElements','add','every','filter','destroy','targetRect','isArray','remove','function','_getNormalizedTarget','_type','refreshVisibility','render','target','item','mainView','_target','_assertCorrectTarget','isActive','stopListening','focusTracker','nodeType','offsetParent','isVisible','innerView'];(function(_0x504d8a,_0x7d4a06){const _0x59dd62=function(_0x3e80b2){while(--_0x3e80b2){_0x504d8a['push'](_0x504d8a['shift']());}};_0x59dd62(++_0x7d4a06);}(_0x7d4a,0x1b5));const _0x59dd=function(_0x504d8a,_0x7d4a06){_0x504d8a=_0x504d8a-0x0;let _0x59dd62=_0x7d4a[_0x504d8a];return _0x59dd62;};import{CKEditorError as _0xa45750,Rect as _0x3e2b36,Collection as _0x2ad174,ObservableMixin as _0x3bb101}from'ckeditor5/src/utils.js';export default class d extends _0x3bb101(){constructor({view:_0x211616,target:_0x31ce7f,type:_0x3e88d7,isVisible:_0x18d2f4=!0x0}){super(),this[_0x59dd('0xc')]=_0x211616,this[_0x59dd('0xc')]['element']||this['view'][_0x59dd('0x1a')](),this[_0x59dd('0x18')]=_0x3e88d7,this[_0x59dd('0x2')]=_0x31ce7f,d['_assertCorrectTarget'](this[_0x59dd('0x17')]()),this[_0x59dd('0xe')]=new _0x2ad174([this[_0x59dd('0xc')]['element']],{'idProperty':'_id'}),this['focusableElements']['on'](_0x59dd('0xf'),(_0x8d3004,_0x379474)=>{this[_0x59dd('0xc')]['focusTracker'][_0x59dd('0xf')](_0x379474);}),this[_0x59dd('0xe')]['on'](_0x59dd('0x15'),(_0x53b9fc,_0x46c2e0)=>{this[_0x59dd('0xc')][_0x59dd('0x6')]['remove'](_0x46c2e0);}),this[_0x59dd('0xd')](_0x59dd('0x9'),_0x18d2f4);}get['type'](){return _0x59dd('0x16')==typeof this[_0x59dd('0x18')]?this[_0x59dd('0x18')]():this[_0x59dd('0x18')];}get[_0x59dd('0xa')](){return this[_0x59dd('0xc')][_0x59dd('0x1')];}get[_0x59dd('0x1b')](){const _0x517248=this[_0x59dd('0x17')]();return d[_0x59dd('0x3')](_0x517248),_0x517248;}get['targetRect'](){const _0x435a17=this['target'];if(null===_0x435a17)return null;if(_0x435a17 instanceof _0x3e2b36)return _0x435a17;const _0x3d6dfc=_0x435a17[_0x59dd('0x11')](_0x32bea4=>function(_0x48449f){const _0xbc8711=_0x48449f[_0x59dd('0x8')];if(_0xbc8711)return!0x0;const _0x1f9c8e=_0x48449f['getClientRects']()['item'](0x0);return!!_0x1f9c8e;}(_0x32bea4));return 0x0===_0x3d6dfc['length']?null:new _0x3e2b36(_0x3d6dfc[0x0]['getClientRects']()[_0x59dd('0x0')](0x0));}get['isActive'](){return this[_0x59dd('0xc')]['isActive'];}set[_0x59dd('0x4')](_0x7bc304){this[_0x59dd('0xc')][_0x59dd('0x4')]=_0x7bc304,this[_0x59dd('0xc')][_0x59dd('0x1')][_0x59dd('0x4')]=_0x7bc304;}['updateTargetRect'](){this[_0x59dd('0xc')][_0x59dd('0x13')]=this[_0x59dd('0x13')];}[_0x59dd('0x12')](){this[_0x59dd('0xe')]['stopListening'](),this['focusableElements']['clear'](),this[_0x59dd('0x5')]();}[_0x59dd('0x19')](){this[_0x59dd('0x9')]=!!this[_0x59dd('0x13')];}static[_0x59dd('0x3')](_0x1ce8f7){if(!(null===_0x1ce8f7||_0x1ce8f7 instanceof _0x3e2b36||Array[_0x59dd('0x14')](_0x1ce8f7)&&_0x1ce8f7[_0x59dd('0x10')](_0x579a58=>y(_0x579a58))))throw new _0xa45750(_0x59dd('0xb'),null,{'target':_0x1ce8f7});}['_getNormalizedTarget'](){const _0x5861b5=_0x59dd('0x16')==typeof this['_target']?this[_0x59dd('0x2')]():this[_0x59dd('0x2')];return y(_0x5861b5)?[_0x5861b5]:_0x5861b5;}}function y(_0x414a91){return null!==_0x414a91&&'object'==typeof _0x414a91&&_0x59dd('0x7')in _0x414a91&&0x1===_0x414a91['nodeType'];}
|
|
@@ -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.js';
|
|
6
|
+
import type { View } from 'ckeditor5/src/ui.js';
|
|
7
|
+
import type Annotation from './annotation.js';
|
|
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 _0x101e=['updateTargetRect','_focusTracker','destroy','fire','getByInnerView','view','left','getByView','_innerViewToAnnotation','change:isFocused','add','annotationcollection-duplicated-item','innerView','isFocused','annotationcollection-not-existing-item','focusTracker','getIndex','from','_sort','listenTo','set','get','_viewToAnnotation','_getOrderInContent','has','sort','clear','remove','focusableElements','targetRect','top','stopListening','length','delete','blur'];(function(_0x55457a,_0x101e05){const _0xe04e4b=function(_0x4ef2da){while(--_0x4ef2da){_0x55457a['push'](_0x55457a['shift']());}};_0xe04e4b(++_0x101e05);}(_0x101e,0x1ca));const _0xe04e=function(_0x55457a,_0x101e05){_0x55457a=_0x55457a-0x0;let _0xe04e4b=_0x101e[_0x55457a];return _0xe04e4b;};import{CKEditorError as _0xaa3ab7,Collection as _0x26cb33,FocusTracker as _0x339725}from'ckeditor5/src/utils.js';export default class x extends _0x26cb33{constructor(_0x2a8091=[]){super(),this['_innerViewToAnnotation']=new Map(),this[_0xe04e('0x13')]=new Map(),this['_focusTracker']=new _0x339725(),this['_focusTracker']['on'](_0xe04e('0x6'),(_0x1becd6,_0x3e48f4,_0x5f2210)=>{_0x5f2210||this['fire'](_0xe04e('0x1f'));});for(const _0xf3be07 of _0x2a8091)this[_0xe04e('0x7')](_0xf3be07);}get[_0xe04e('0xa')](){return this[_0xe04e('0x21')][_0xe04e('0xa')];}[_0xe04e('0x7')](_0xa4d2c6){if(this['has'](_0xa4d2c6))throw new _0xaa3ab7(_0xe04e('0x8'),null);this[_0xe04e('0x5')]['set'](_0xa4d2c6[_0xe04e('0x9')],_0xa4d2c6),this[_0xe04e('0x13')][_0xe04e('0x11')](_0xa4d2c6[_0xe04e('0x2')],_0xa4d2c6);for(const _0x97943 of _0xa4d2c6[_0xe04e('0x19')])this['_focusTracker'][_0xe04e('0x7')](_0x97943);this['listenTo'](_0xa4d2c6[_0xe04e('0x19')],_0xe04e('0x7'),(_0x3264a8,_0x198f96)=>{this[_0xe04e('0x21')]['add'](_0x198f96);}),this[_0xe04e('0x10')](_0xa4d2c6['focusableElements'],_0xe04e('0x18'),(_0xf11a48,_0x2d9520)=>{this[_0xe04e('0x21')][_0xe04e('0x18')](_0x2d9520);}),this[_0xe04e('0x10')](_0xa4d2c6[_0xe04e('0x2')][_0xe04e('0xc')],_0xe04e('0x6'),(_0x11b79f,_0x5235b2,_0xcb138f)=>{_0xcb138f&&this[_0xe04e('0x0')]('focus',_0xa4d2c6);}),_0xa4d2c6[_0xe04e('0x20')]();const _0x201d93=this[_0xe04e('0x14')](_0xa4d2c6[_0xe04e('0x2')]['targetRect']);return super['add'](_0xa4d2c6,_0x201d93);}[_0xe04e('0x18')](_0x3863dd){if(!this[_0xe04e('0x15')](_0x3863dd))throw new _0xaa3ab7(_0xe04e('0xb'),null);this[_0xe04e('0x1c')](_0x3863dd[_0xe04e('0x2')]['focusTracker']),this['stopListening'](_0x3863dd[_0xe04e('0x19')]);for(const _0x587c04 of _0x3863dd[_0xe04e('0x19')])this[_0xe04e('0x21')]['remove'](_0x587c04);return this[_0xe04e('0x13')][_0xe04e('0x1e')](_0x3863dd[_0xe04e('0x2')]),this[_0xe04e('0x5')][_0xe04e('0x1e')](_0x3863dd[_0xe04e('0x9')]),super[_0xe04e('0x18')](_0x3863dd);}[_0xe04e('0x1')](_0x5ebfa5){return this[_0xe04e('0x5')][_0xe04e('0x12')](_0x5ebfa5);}[_0xe04e('0x4')](_0x423c58){return this['_viewToAnnotation'][_0xe04e('0x12')](_0x423c58);}[_0xe04e('0x22')](){super[_0xe04e('0x17')](),this['stopListening'](),this['_innerViewToAnnotation'][_0xe04e('0x17')](),this[_0xe04e('0x13')][_0xe04e('0x17')](),this[_0xe04e('0x21')]['destroy']();}['refreshPositioning'](){for(const _0x4b0c06 of this)_0x4b0c06[_0xe04e('0x20')]();this[_0xe04e('0xf')]();}[_0xe04e('0xf')](){const _0x204071=Array[_0xe04e('0xe')](this)[_0xe04e('0x16')]((_0x17510a,_0x39a16d)=>v(_0x17510a[_0xe04e('0x2')][_0xe04e('0x1a')],_0x39a16d[_0xe04e('0x2')][_0xe04e('0x1a')]));for(let _0x520d0b=_0x204071['length']-0x1;_0x520d0b>0x0;_0x520d0b--){const _0x353a44=_0x204071[_0x520d0b];_0x520d0b!==this[_0xe04e('0xd')](_0x353a44)&&(this['remove'](_0x353a44),this[_0xe04e('0x7')](_0x353a44));}}['_getOrderInContent'](_0xb2d1f2){let _0x114243=0x0;if(!_0xb2d1f2)return this[_0xe04e('0x1d')];for(const _0xbea4fc of this){const _0x57026c=_0xbea4fc[_0xe04e('0x2')][_0xe04e('0x1a')];if(_0x57026c){if(v(_0xb2d1f2,_0x57026c)<0x0)return _0x114243;_0x114243++;}}return _0x114243;}}export function bindAnnotationCollections({source:_0x5320d2,target:_0xc6a7c2,filter:_0x4dfe48}){for(const _0x25b9f1 of _0x5320d2)_0x4dfe48(_0x25b9f1)&&_0xc6a7c2[_0xe04e('0x7')](_0x25b9f1);_0xc6a7c2[_0xe04e('0x10')](_0x5320d2,_0xe04e('0x7'),(_0x5d529b,_0x5a94de)=>{_0x4dfe48(_0x5a94de)&&_0xc6a7c2[_0xe04e('0x7')](_0x5a94de);}),_0xc6a7c2['listenTo'](_0x5320d2,_0xe04e('0x18'),(_0x542d68,_0x1393ff)=>{_0xc6a7c2[_0xe04e('0x15')](_0x1393ff)&&_0xc6a7c2[_0xe04e('0x18')](_0x1393ff);});}function v(_0x347684,_0x3a99b7){if(null===_0x347684&&null===_0x3a99b7)return 0x0;if(null===_0x347684)return-0x1;if(null===_0x3a99b7)return 0x1;const _0x48d24f=_0x347684[_0xe04e('0x1b')]-_0x3a99b7[_0xe04e('0x1b')];return 0x0==_0x48d24f?_0x347684[_0xe04e('0x3')]-_0x3a99b7[_0xe04e('0x3')]:_0x48d24f;}
|