@ckeditor/ckeditor5-comments 36.0.1 → 37.0.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/build/comments.js +2 -2
- package/build/translations/af.js +1 -1
- package/build/translations/ar.js +1 -1
- package/build/translations/bg.js +1 -1
- package/build/translations/bn.js +1 -1
- package/build/translations/bs.js +1 -1
- package/build/translations/ca.js +1 -1
- package/build/translations/cs.js +1 -1
- package/build/translations/da.js +1 -1
- package/build/translations/de-ch.js +1 -1
- package/build/translations/de.js +1 -1
- package/build/translations/el.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/es-co.js +1 -1
- package/build/translations/es.js +1 -1
- package/build/translations/et.js +1 -1
- package/build/translations/fa.js +1 -1
- package/build/translations/fi.js +1 -1
- package/build/translations/fr.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/he.js +1 -1
- package/build/translations/hi.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/hu.js +1 -1
- package/build/translations/id.js +1 -1
- package/build/translations/it.js +1 -1
- package/build/translations/ja.js +1 -1
- package/build/translations/jv.js +1 -1
- package/build/translations/ko.js +1 -1
- package/build/translations/lt.js +1 -1
- package/build/translations/lv.js +1 -1
- package/build/translations/ms.js +1 -1
- package/build/translations/nl.js +1 -1
- package/build/translations/no.js +1 -1
- package/build/translations/pl.js +1 -1
- package/build/translations/pt-br.js +1 -1
- package/build/translations/pt.js +1 -1
- package/build/translations/ro.js +1 -1
- package/build/translations/ru.js +1 -1
- package/build/translations/sk.js +1 -1
- package/build/translations/sr-latn.js +1 -1
- package/build/translations/sr.js +1 -1
- package/build/translations/sv.js +1 -1
- package/build/translations/th.js +1 -1
- package/build/translations/tk.js +1 -1
- package/build/translations/tr.js +1 -1
- package/build/translations/tt.js +1 -1
- package/build/translations/ug.js +1 -1
- package/build/translations/uk.js +1 -1
- package/build/translations/ur.js +1 -1
- package/build/translations/vi.js +1 -1
- package/build/translations/zh-cn.js +1 -1
- package/build/translations/zh.js +1 -1
- package/lang/contexts.json +8 -1
- package/lang/translations/af.po +28 -0
- package/lang/translations/ar.po +28 -0
- package/lang/translations/bg.po +28 -0
- package/lang/translations/bn.po +28 -0
- package/lang/translations/bs.po +28 -0
- package/lang/translations/ca.po +28 -0
- package/lang/translations/cs.po +28 -0
- package/lang/translations/da.po +28 -0
- package/lang/translations/de-ch.po +28 -0
- package/lang/translations/de.po +28 -0
- package/lang/translations/el.po +28 -0
- package/lang/translations/en-au.po +28 -0
- package/lang/translations/en.po +28 -0
- package/lang/translations/es-co.po +28 -0
- package/lang/translations/es.po +28 -0
- package/lang/translations/et.po +28 -0
- package/lang/translations/fa.po +28 -0
- package/lang/translations/fi.po +28 -0
- package/lang/translations/fr.po +28 -0
- package/lang/translations/gl.po +28 -0
- package/lang/translations/he.po +28 -0
- package/lang/translations/hi.po +28 -0
- package/lang/translations/hr.po +28 -0
- package/lang/translations/hu.po +28 -0
- package/lang/translations/id.po +28 -0
- package/lang/translations/it.po +28 -0
- package/lang/translations/ja.po +28 -0
- package/lang/translations/jv.po +28 -0
- package/lang/translations/ko.po +28 -0
- package/lang/translations/lt.po +28 -0
- package/lang/translations/lv.po +28 -0
- package/lang/translations/ms.po +28 -0
- package/lang/translations/nl.po +28 -0
- package/lang/translations/no.po +28 -0
- package/lang/translations/pl.po +28 -0
- package/lang/translations/pt-br.po +28 -0
- package/lang/translations/pt.po +28 -0
- package/lang/translations/ro.po +28 -0
- package/lang/translations/ru.po +28 -0
- package/lang/translations/sk.po +28 -0
- package/lang/translations/sr-latn.po +28 -0
- package/lang/translations/sr.po +29 -1
- package/lang/translations/sv.po +28 -0
- package/lang/translations/th.po +28 -0
- package/lang/translations/tk.po +28 -0
- package/lang/translations/tr.po +28 -0
- package/lang/translations/tt.po +28 -0
- package/lang/translations/ug.po +28 -0
- package/lang/translations/uk.po +28 -0
- package/lang/translations/ur.po +28 -0
- package/lang/translations/vi.po +28 -0
- package/lang/translations/zh-cn.po +28 -0
- package/lang/translations/zh.po +28 -0
- package/package.json +19 -3
- package/src/annotations/annotation.d.ts +86 -0
- package/src/annotations/annotation.js +1 -1
- package/src/annotations/annotationcollection.d.ts +94 -0
- package/src/annotations/annotationcollection.js +1 -1
- package/src/annotations/annotations.d.ts +150 -0
- package/src/annotations/annotations.js +1 -1
- package/src/annotations/annotationsuis.d.ts +227 -0
- package/src/annotations/annotationsuis.js +1 -1
- package/src/annotations/editorannotations.d.ts +62 -0
- package/src/annotations/editorannotations.js +1 -1
- package/src/annotations/inlineannotations.d.ts +84 -0
- package/src/annotations/inlineannotations.js +1 -1
- package/src/annotations/narrowsidebar.d.ts +80 -0
- package/src/annotations/narrowsidebar.js +1 -1
- package/src/annotations/sidebar.d.ts +96 -0
- package/src/annotations/sidebar.js +1 -1
- package/src/annotations/view/annotationcounterbuttonview.d.ts +25 -0
- package/src/annotations/view/annotationcounterbuttonview.js +1 -1
- package/src/annotations/view/annotationview.d.ts +86 -0
- package/src/annotations/view/annotationview.js +1 -1
- package/src/annotations/view/sidebaritemview.d.ts +51 -0
- package/src/annotations/view/sidebaritemview.js +1 -1
- package/src/annotations/view/sidebarview.d.ts +28 -0
- package/src/annotations/view/sidebarview.js +1 -1
- package/src/annotations/widesidebar.d.ts +72 -0
- package/src/annotations/widesidebar.js +1 -1
- package/src/augmentation.d.ts +54 -0
- package/src/augmentation.js +23 -0
- package/src/comments/addcommentthreadcommand.d.ts +31 -0
- package/src/comments/addcommentthreadcommand.js +1 -1
- package/src/comments/commentsarchive.d.ts +25 -0
- package/src/comments/commentsarchive.js +23 -0
- package/src/comments/commentsarchiveui.d.ts +32 -0
- package/src/comments/commentsarchiveui.js +23 -0
- package/src/comments/commentsediting.d.ts +71 -0
- package/src/comments/commentsediting.js +1 -1
- package/src/comments/commentsrepository.d.ts +1009 -0
- package/src/comments/commentsrepository.js +1 -1
- package/src/comments/commentsui.d.ts +25 -0
- package/src/comments/commentsui.js +1 -1
- package/src/comments/integrations/commentsrestrictededitingmode.d.ts +13 -0
- package/src/comments/integrations/commentsrestrictededitingmode.js +1 -1
- package/src/comments/integrations/importword.d.ts +17 -0
- package/src/comments/integrations/importword.js +1 -1
- package/src/comments/ui/commenteditor/commenteditor.d.ts +32 -0
- package/src/comments/ui/commenteditor/commenteditor.js +1 -1
- package/src/comments/ui/commenteditor/commenteditorui.d.ts +27 -0
- package/src/comments/ui/commenteditor/commenteditorui.js +1 -1
- package/src/comments/ui/commenteditor/commenteditoruiview.d.ts +32 -0
- package/src/comments/ui/commenteditor/commenteditoruiview.js +1 -1
- package/src/comments/ui/commentthreadcontroller.d.ts +64 -0
- package/src/comments/ui/commentthreadcontroller.js +1 -1
- package/src/comments/ui/view/basecommentthreadview.d.ts +108 -0
- package/src/comments/ui/view/basecommentthreadview.js +1 -1
- package/src/comments/ui/view/basecommentview.d.ts +108 -0
- package/src/comments/ui/view/basecommentview.js +1 -1
- package/src/comments/ui/view/collapsedcommentsview.d.ts +9 -0
- package/src/comments/ui/view/collapsedcommentsview.js +1 -1
- package/src/comments/ui/view/commentcontentview.d.ts +10 -0
- package/src/comments/ui/view/commentcontentview.js +1 -1
- package/src/comments/ui/view/commentinputview.d.ts +76 -0
- package/src/comments/ui/view/commentinputview.js +1 -1
- package/src/comments/ui/view/commentsarchiveview.d.ts +34 -0
- package/src/comments/ui/view/commentsarchiveview.js +23 -0
- package/src/comments/ui/view/commentslistview.d.ts +96 -0
- package/src/comments/ui/view/commentslistview.js +1 -1
- package/src/comments/ui/view/commentthreadheaderview.d.ts +46 -0
- package/src/comments/ui/view/commentthreadheaderview.js +23 -0
- package/src/comments/ui/view/commentthreadinputview.d.ts +37 -0
- package/src/comments/ui/view/commentthreadinputview.js +1 -1
- package/src/comments/ui/view/commentthreadview.d.ts +108 -0
- package/src/comments/ui/view/commentthreadview.js +1 -1
- package/src/comments/ui/view/commentview.d.ts +231 -0
- package/src/comments/ui/view/commentview.js +1 -1
- package/src/comments.d.ts +22 -0
- package/src/comments.js +1 -1
- package/src/commentsonly.d.ts +28 -0
- package/src/commentsonly.js +1 -1
- package/src/config.d.ts +172 -0
- package/src/config.js +23 -0
- package/src/index.d.ts +19 -0
- package/src/index.js +1 -1
- package/src/utils/common-translations.d.ts +5 -0
- package/src/utils/common-translations.js +1 -1
- package/src/utils/createmutationobserver.d.ts +13 -0
- package/src/utils/createmutationobserver.js +1 -1
- package/theme/annotation.css +1 -0
- package/theme/comment.css +31 -0
- package/theme/commentsarchive.css +40 -0
- package/theme/commentthread.css +68 -1
- package/theme/icons/add-comment.svg +1 -1
- package/theme/icons/comments-archive.svg +11 -0
- package/theme/icons/undo.svg +1 -0
- package/theme/sidebar.css +4 -0
|
@@ -0,0 +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(): '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 _0x49c2=['activeAnnotations','activate','set','destroy','Annotations','fire','createAnnotationView','refreshPositioning','getByInnerView','view','collection','listenTo','change:isVisible','isVisible','_visibleAnnotations','focusTracker','_activateAnnotation','_addActiveAnnotation','deactivateAll','stopListening','add','remove','has','delete','refreshVisibility','element','_deactivateAllAnnotations','_removeActiveAnnotation','createAnnotation'];(function(_0x51f07e,_0x49c243){const _0x1040a8=function(_0x5b7edf){while(--_0x5b7edf){_0x51f07e['push'](_0x51f07e['shift']());}};_0x1040a8(++_0x49c243);}(_0x49c2,0x1bc));const _0x1040=function(_0x51f07e,_0x49c243){_0x51f07e=_0x51f07e-0x0;let _0x1040a8=_0x49c2[_0x51f07e];return _0x1040a8;};import{ContextPlugin as _0x2544da}from'ckeditor5/src/core';import _0x39cd61 from'./annotation';import _0x424dbb from'./annotationcollection';import _0x45ec7d from'./view/annotationview';export default class b extends _0x2544da{static get['pluginName'](){return _0x1040('0x18');}constructor(_0x4759ae){super(_0x4759ae),this[_0x1040('0x1')]=new _0x424dbb(),this[_0x1040('0x5')]=new _0x424dbb(),this[_0x1040('0x16')](_0x1040('0x14'),new Set()),this['_bindAnnotationsToVisibleAnnotations']();}['add'](_0x51c780){this[_0x1040('0x1')][_0x1040('0xb')](_0x51c780);}['remove'](_0x33be38){this['collection'][_0x1040('0xc')](_0x33be38),_0x33be38[_0x1040('0x17')]();}[_0x1040('0xf')](){for(const _0x29287b of this[_0x1040('0x1')])_0x29287b[_0x1040('0xf')]();}[_0x1040('0x1b')](){this[_0x1040('0x5')][_0x1040('0x1b')]();}['getByInnerView'](_0x52d660){return this['collection'][_0x1040('0x1c')](_0x52d660);}[_0x1040('0x9')](){this[_0x1040('0x19')](_0x1040('0x11'));}['destroy'](){for(const _0x3cf91f of this[_0x1040('0x1')])_0x3cf91f[_0x1040('0x17')]();this[_0x1040('0x5')][_0x1040('0x17')](),this[_0x1040('0x1')][_0x1040('0x17')](),super['destroy']();}[_0x1040('0x15')](_0x2d2c0b){this[_0x1040('0x19')](_0x1040('0x7'),_0x2d2c0b);}[_0x1040('0x13')](_0x3bd74f){return new _0x39cd61(_0x3bd74f);}[_0x1040('0x1a')](_0xf79294,_0x5c18f0){return new _0x45ec7d(_0xf79294,_0x5c18f0);}[_0x1040('0x8')](_0x282228){const _0xb244de=new Set(this[_0x1040('0x14')]);_0xb244de['add'](_0x282228),this[_0x1040('0x14')]=_0xb244de;}[_0x1040('0x12')](_0x1000a5){const _0x3b7c38=new Set(this['activeAnnotations']);_0x3b7c38[_0x1040('0xe')](_0x1000a5),this['activeAnnotations']=_0x3b7c38;}['_bindAnnotationsToVisibleAnnotations'](){const _0x44a355=this['collection'],_0x566aef=this[_0x1040('0x5')];function _0xbfc5aa(_0x3f05be){const _0x38e8de=_0x3f05be['source'];_0x38e8de[_0x1040('0x4')]&&!_0x566aef[_0x1040('0xd')](_0x38e8de)?_0x566aef[_0x1040('0xb')](_0x38e8de):!_0x38e8de[_0x1040('0x4')]&&_0x566aef['has'](_0x38e8de)&&_0x566aef[_0x1040('0xc')](_0x38e8de),_0x38e8de[_0x1040('0x0')][_0x1040('0x6')][_0x1040('0xc')](_0x38e8de[_0x1040('0x0')]['element']),_0x38e8de[_0x1040('0x0')][_0x1040('0x6')][_0x1040('0xb')](_0x38e8de['view'][_0x1040('0x10')]);}this[_0x1040('0x2')](_0x44a355,'add',(_0x525458,_0x3a0ef1)=>{_0x3a0ef1['isVisible']&&_0x566aef['add'](_0x3a0ef1),this[_0x1040('0x2')](_0x3a0ef1,_0x1040('0x3'),_0xbfc5aa);}),this[_0x1040('0x2')](_0x44a355,'remove',(_0x3ec650,_0x7f1fb0)=>{_0x566aef[_0x1040('0xd')](_0x7f1fb0)&&_0x566aef[_0x1040('0xc')](_0x7f1fb0),this[_0x1040('0xa')](_0x7f1fb0,_0x1040('0x3'),_0xbfc5aa);});}}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module comments/annotations/annotationsuis
|
|
3
|
+
* @publicApi
|
|
4
|
+
*/
|
|
5
|
+
import { ContextPlugin, type Plugin, type PluginDependencies, type Editor, type Context } from 'ckeditor5/src/core';
|
|
6
|
+
import { type Emitter } from 'ckeditor5/src/utils';
|
|
7
|
+
import AnnotationCollection from './annotationcollection';
|
|
8
|
+
import type Annotation from './annotation';
|
|
9
|
+
/**
|
|
10
|
+
* A repository of annotations UIs.
|
|
11
|
+
*
|
|
12
|
+
* The main entry point for {@link module:comments/annotations/annotationsuis~AnnotationsUIs#register registering} UIs
|
|
13
|
+
* and activating the annotations UI(s), which display annotation views.
|
|
14
|
+
*
|
|
15
|
+
* To register a custom annotations UI use following code in the annotations UI plugin `init()` function:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* const annotationsUIs = editor.plugins.get( 'annotationsUIs' );
|
|
19
|
+
*
|
|
20
|
+
* annotationsUIs.register( customAnnotationsUIPlugin );
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Note that the custom annotations UI must implement {@link module:comments/annotations/annotationsuis~AnnotationsUI
|
|
24
|
+
* the `AnnotationsUI` interface}.
|
|
25
|
+
*
|
|
26
|
+
* To activate an annotations UI, use the {@link module:comments/annotations/annotationsuis~AnnotationsUIs#switchTo
|
|
27
|
+
* `switchTo( uiName )`} method. This method activates the given UI and deactivates all the other UIs.
|
|
28
|
+
* All annotations will be handled by the activated UI.
|
|
29
|
+
*
|
|
30
|
+
* It is also possible to activate multiple annotations UIs at the same time and make the UIs handle different sets of annotations.
|
|
31
|
+
* To do that, use the {@link module:comments/annotations/annotationsuis~AnnotationsUIs#activate `activate( uiName, filter )`} method.
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* // Suggestions annotations are shown inline in a balloon:
|
|
35
|
+
* annotationsUIs.activate( 'inline', annotation => annotation.type.startsWith( 'suggestion' ) );
|
|
36
|
+
*
|
|
37
|
+
* // At the same time, comments annotations are shown in a sidebar:
|
|
38
|
+
* annotationsUIs.activate( 'wideSidebar', annotation => annotation.type === 'comment' );
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* Limitations:
|
|
42
|
+
*
|
|
43
|
+
* * Some annotations UI plugins might collide with each other (like {@link module:comments/annotations/narrowsidebar~NarrowSidebar} and
|
|
44
|
+
* {@link module:comments/annotations/widesidebar~WideSidebar} that operates on the same sidebar). They cannot be activated at the same
|
|
45
|
+
* time.
|
|
46
|
+
* * It is not possible to display the same annotation in two different annotations UIs. In this scenario an error will be thrown.
|
|
47
|
+
*/
|
|
48
|
+
export default class AnnotationsUIs extends ContextPlugin {
|
|
49
|
+
/**
|
|
50
|
+
* A set of names of the active annotations UIs.
|
|
51
|
+
*
|
|
52
|
+
* To activate the annotations UI, use {@link module:comments/annotations/annotationsuis~AnnotationsUIs#activate}
|
|
53
|
+
* or {@link #switchTo} methods.
|
|
54
|
+
*/
|
|
55
|
+
activeUIs: Set<string>;
|
|
56
|
+
/**
|
|
57
|
+
* @inheritDoc
|
|
58
|
+
*/
|
|
59
|
+
static get requires(): PluginDependencies<Context | Editor>;
|
|
60
|
+
/**
|
|
61
|
+
* @inheritDoc
|
|
62
|
+
*/
|
|
63
|
+
static get pluginName(): 'AnnotationsUIs';
|
|
64
|
+
/**
|
|
65
|
+
* @inheritDoc
|
|
66
|
+
*/
|
|
67
|
+
constructor(context: Context | Editor);
|
|
68
|
+
/**
|
|
69
|
+
* @inheritDoc
|
|
70
|
+
*/
|
|
71
|
+
init(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Returns `true` if at least one registered UI is active.
|
|
74
|
+
*/
|
|
75
|
+
hasActive(): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Returns `true` if the given UI is active.
|
|
78
|
+
*/
|
|
79
|
+
isActive(uiName: string): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Activates an annotations UI.
|
|
82
|
+
*
|
|
83
|
+
* Note that the custom annotations UI should be {@link #register registered} before the activation.
|
|
84
|
+
*
|
|
85
|
+
* The `filter` parameter can be used to display on some of the annotations in the given annotations UI. Thanks to that,
|
|
86
|
+
* all annotations can be split into various annotations UIs.
|
|
87
|
+
*
|
|
88
|
+
* The `filter` function takes an {@link module:comments/annotations/annotation~Annotation} instance as the first and only parameter,
|
|
89
|
+
* and should return `true` if that annotation should be placed in the given annotations UI.
|
|
90
|
+
*
|
|
91
|
+
* @param uiName The name of the annotations UI to activate.
|
|
92
|
+
* @param filter The annotation filter function. If not specified, the UI will use all annotations.
|
|
93
|
+
*/
|
|
94
|
+
activate(uiName: string, filter?: () => boolean): void;
|
|
95
|
+
/**
|
|
96
|
+
* Deactivates annotations UI with given name.
|
|
97
|
+
*
|
|
98
|
+
* @param uiName The name of the annotations UI to deactivate.
|
|
99
|
+
*/
|
|
100
|
+
deactivate(uiName: string): void;
|
|
101
|
+
/**
|
|
102
|
+
* Switches the annotations UI to the one with given name.
|
|
103
|
+
*
|
|
104
|
+
* It preserves the currently active annotation.
|
|
105
|
+
*
|
|
106
|
+
* @param uiName The name of the annotations UI to switch to.
|
|
107
|
+
*/
|
|
108
|
+
switchTo(uiName: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* Deactivates all annotations UIs.
|
|
111
|
+
*/
|
|
112
|
+
deactivateAll(): void;
|
|
113
|
+
/**
|
|
114
|
+
* Registers an annotations UI. It might be one of:
|
|
115
|
+
*
|
|
116
|
+
* * {@link module:comments/annotations/widesidebar~WideSidebar},
|
|
117
|
+
* * {@link module:comments/annotations/narrowsidebar~NarrowSidebar},
|
|
118
|
+
* * {@link module:comments/annotations/inlineannotations~InlineAnnotations}.
|
|
119
|
+
*
|
|
120
|
+
* It is possible to provide your own, custom annotations UI plugin. It has to implement
|
|
121
|
+
* {@link module:comments/annotations/annotationsuis~AnnotationsUI the `AnnotationsUI` interface}.
|
|
122
|
+
*
|
|
123
|
+
* @param uiName Annotations UI name.
|
|
124
|
+
* @param annotationsUI Annotations UI plugin instance.
|
|
125
|
+
*/
|
|
126
|
+
register(uiName: string, annotationsUI: AnnotationsUI<ContextPlugin | Plugin>): void;
|
|
127
|
+
/**
|
|
128
|
+
* Refilters annotations to proper UIs based on filters provided earlier during the
|
|
129
|
+
* {@link module:comments/annotations/annotationsuis~AnnotationsUIs#activate annotations UIs activation}.
|
|
130
|
+
*
|
|
131
|
+
* This method should be used if the annotations UIs filtering functions return different results than before
|
|
132
|
+
* for some annotations. It only reattaches these annotations, which should change their UIs.
|
|
133
|
+
*/
|
|
134
|
+
refilterAnnotations(): void;
|
|
135
|
+
/**
|
|
136
|
+
* @inheritDoc
|
|
137
|
+
*/
|
|
138
|
+
destroy(): void;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* An interface for the annotations UI plugin class.
|
|
142
|
+
*
|
|
143
|
+
* The annotations UI class handles displaying, focusing, activating and hiding annotations views.
|
|
144
|
+
*
|
|
145
|
+
* The annotations UI class must be a plugin, so it has to extend the {@link module:core/plugin~Plugin} or
|
|
146
|
+
* {@link module:core/contextplugin~ContextPlugin} class.
|
|
147
|
+
*
|
|
148
|
+
* Examples of `AnnotationsUI` are:
|
|
149
|
+
*
|
|
150
|
+
* * {@link module:comments/annotations/widesidebar~WideSidebar},
|
|
151
|
+
* * {@link module:comments/annotations/narrowsidebar~NarrowSidebar},
|
|
152
|
+
* * {@link module:comments/annotations/inlineannotations~InlineAnnotations}.
|
|
153
|
+
*
|
|
154
|
+
* You can use the following snippet as a base for your own annotations UI:
|
|
155
|
+
*
|
|
156
|
+
* ```ts
|
|
157
|
+
* class MyAnnotationsUI extends ContextPlugin {
|
|
158
|
+
* constructor( ...args ) {
|
|
159
|
+
* super( ...args );
|
|
160
|
+
*
|
|
161
|
+
* this.set( 'activeAnnotation', null );
|
|
162
|
+
* }
|
|
163
|
+
*
|
|
164
|
+
* attach( annotations ) {
|
|
165
|
+
* // Do something when an annotation is added.
|
|
166
|
+
* this.listenTo( annotations, 'add', ( evt, annotation ) => { ... } );
|
|
167
|
+
*
|
|
168
|
+
* // Do something when an annotation is removed.
|
|
169
|
+
* this.listenTo( annotations, 'remove', ( evt, annotation ) => { ... } );
|
|
170
|
+
* }
|
|
171
|
+
*
|
|
172
|
+
* detach() {
|
|
173
|
+
* this.stopListening();
|
|
174
|
+
* }
|
|
175
|
+
*
|
|
176
|
+
* setActiveAnnotation( annotation ) {
|
|
177
|
+
* if ( this.activeAnnotation ) {
|
|
178
|
+
* this.activeAnnotation.isActive = false;
|
|
179
|
+
*
|
|
180
|
+
* // You can do something in your UI with the annotation that is no longer active.
|
|
181
|
+
* }
|
|
182
|
+
*
|
|
183
|
+
* this.activeAnnotation = annotation;
|
|
184
|
+
* this.activeAnnotation.isActive = true;
|
|
185
|
+
*
|
|
186
|
+
* // You can do something in your UI to highlight the active annotation.
|
|
187
|
+
* }
|
|
188
|
+
* }
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
export interface AnnotationUI {
|
|
192
|
+
/**
|
|
193
|
+
* Observable `activeAnnotation` property. {@link module:comments/annotations/annotationsuis~AnnotationsUIs} listens to changes on that
|
|
194
|
+
* property.
|
|
195
|
+
*
|
|
196
|
+
* To make this property observable use `this.set( 'activeAnnotation', null )` in the constructor.
|
|
197
|
+
*/
|
|
198
|
+
activeAnnotation: Annotation | null;
|
|
199
|
+
/**
|
|
200
|
+
* Creates everything needed for the UI and attaches all listeners. This method is called when the UI is activated.
|
|
201
|
+
*
|
|
202
|
+
* The observable collection of annotations is passed as the first argument,
|
|
203
|
+
* and the annotations UI is responsible for reacting to its changes.
|
|
204
|
+
*/
|
|
205
|
+
attach: (annotationCollection: AnnotationCollection) => void;
|
|
206
|
+
/**
|
|
207
|
+
* Destroys the UI and removes all listeners. This method is called when the UI is deactivated.
|
|
208
|
+
*/
|
|
209
|
+
detach: () => void;
|
|
210
|
+
/**
|
|
211
|
+
* Sets or unsets the active annotation. This method is called when an annotation is activated, for example, user puts their
|
|
212
|
+
* selection into a marker connected with given annotation.
|
|
213
|
+
*
|
|
214
|
+
* This method should change the UI so the new active annotation is differentiated from other annotations.
|
|
215
|
+
*
|
|
216
|
+
* This method should set the
|
|
217
|
+
* {@link #activeAnnotation `AnnotationUI#activeAnnotation`} property.
|
|
218
|
+
*
|
|
219
|
+
* It also should set {@link module:comments/annotations/annotation~Annotation#isActive `Annotation#isActive`} of the deactivated
|
|
220
|
+
* and the activated annotation.
|
|
221
|
+
*
|
|
222
|
+
* @param annotation The new active annotation or null when no annotation is active.
|
|
223
|
+
*/
|
|
224
|
+
setActiveAnnotation: (annotation: Annotation | null) => void;
|
|
225
|
+
_setSelectedAnnotations?: (annotations: Array<Annotation>) => void;
|
|
226
|
+
}
|
|
227
|
+
export type AnnotationsUI<T extends Emitter> = T & AnnotationUI;
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x403f=['requires','push','AnnotationsUIs','_assertAnnotationDoesNotBelongToMultipleUIs','activeUIs','set','annotationsuis-annotation-mismatch','_setSelectedAnnotations','get','activeAnnotations','annotationsuis-missing-ui','deactivate','annotationsuis-register-already-registered','context','detach','remove','_uisData','delete','attach','from','_visibleAnnotations','filter','size','has','type','refilterAnnotations','_uis','collection','listenTo','destroy','activate','change:activeAnnotation','plugins','_removeActiveAnnotation','find','register','setActiveAnnotation','_addActiveAnnotation','stopListening','switchTo','add','isActive','function','pluginName','deactivateAll'];(function(_0x370d65,_0x403f5c){const _0x2ac678=function(_0x4a51ef){while(--_0x4a51ef){_0x370d65['push'](_0x370d65['shift']());}};_0x2ac678(++_0x403f5c);}(_0x403f,0x14b));const _0x2ac6=function(_0x370d65,_0x403f5c){_0x370d65=_0x370d65-0x0;let _0x2ac678=_0x403f[_0x370d65];return _0x2ac678;};import{ContextPlugin as _0x5f3f26}from'ckeditor5/src/core';import{CKEditorError as _0x3ba4f2}from'ckeditor5/src/utils';import _0x2e7693,{bindAnnotationCollections as _0x569b57}from'./annotationcollection';import _0x306da9 from'./annotations';export default class M extends _0x5f3f26{static get[_0x2ac6('0x1d')](){return[_0x306da9];}static get[_0x2ac6('0x1b')](){return _0x2ac6('0x1f');}constructor(_0xc8af6b){super(_0xc8af6b),this[_0x2ac6('0x21')]=new Set(),this['_uis']=new Map(),this[_0x2ac6('0x0')]=new Map();}['init'](){const _0x40f01f=this[_0x2ac6('0x2a')]['plugins'][_0x2ac6('0x25')](_0x306da9);this[_0x2ac6('0xc')](_0x40f01f,'_activateAnnotation',(_0x4787cb,_0x301ac0)=>{for(const _0x31323b of this[_0x2ac6('0x21')]){const _0x120c3d=this[_0x2ac6('0xa')][_0x2ac6('0x25')](_0x31323b);(0x0,this['_uisData']['get'](_0x31323b)[_0x2ac6('0x5')])(_0x301ac0)&&_0x120c3d[_0x2ac6('0x14')](_0x301ac0);}}),this[_0x2ac6('0xc')](_0x40f01f,'_deactivateAllAnnotations',()=>{for(const _0x54c1c9 of this[_0x2ac6('0x21')]){this[_0x2ac6('0xa')][_0x2ac6('0x25')](_0x54c1c9)[_0x2ac6('0x14')](null);}}),this[_0x2ac6('0xc')](_0x40f01f[_0x2ac6('0x4')],_0x2ac6('0x18'),(_0x266fc6,_0x1c4377)=>{this['_assertAnnotationDoesNotBelongToMultipleUIs'](_0x1c4377);});}['hasActive'](){return this[_0x2ac6('0x21')][_0x2ac6('0x6')]>0x0;}[_0x2ac6('0x19')](_0x17da9e){return this['activeUIs']['has'](_0x17da9e);}[_0x2ac6('0xe')](_0x4b1203,_0x28afd0=()=>!0x0){const _0x3d970a=this[_0x2ac6('0x2a')][_0x2ac6('0x10')][_0x2ac6('0x25')](_0x306da9);if(!this[_0x2ac6('0xa')]['has'](_0x4b1203))throw new _0x3ba4f2('annotationsuis-missing-ui',this,{'uiName':_0x4b1203});this[_0x2ac6('0x19')](_0x4b1203)&&this['deactivate'](_0x4b1203),this[_0x2ac6('0x21')]['add'](_0x4b1203);const _0x5970d0=new _0x2e7693(),_0x5e3add=_0x3d970a[_0x2ac6('0x4')];_0x569b57({'source':_0x5e3add,'target':_0x5970d0,'filter':_0x28afd0}),this['_uisData'][_0x2ac6('0x22')](_0x4b1203,{'collection':_0x5970d0,'filter':_0x28afd0});const _0x29aa98=this['_uis'][_0x2ac6('0x25')](_0x4b1203);_0x29aa98[_0x2ac6('0x2')](_0x5970d0),this[_0x2ac6('0xc')](_0x29aa98,_0x2ac6('0xf'),(_0x4c3c48,_0x5d7f7c,_0x15b169,_0x513b8f)=>{_0x513b8f&&_0x3d970a[_0x2ac6('0x11')](_0x513b8f),_0x15b169&&_0x3d970a[_0x2ac6('0x15')](_0x15b169);});}[_0x2ac6('0x28')](_0x317c04){if(this[_0x2ac6('0x21')]['delete'](_0x317c04),!this[_0x2ac6('0xa')][_0x2ac6('0x7')](_0x317c04))throw new _0x3ba4f2(_0x2ac6('0x27'),this,{'uiName':_0x317c04});const _0x1e8355=this[_0x2ac6('0xa')]['get'](_0x317c04);_0x1e8355[_0x2ac6('0x2b')](),this[_0x2ac6('0x16')](_0x1e8355),this[_0x2ac6('0x0')][_0x2ac6('0x25')](_0x317c04)[_0x2ac6('0xb')][_0x2ac6('0xd')](),this['_uisData'][_0x2ac6('0x1')](_0x317c04);}[_0x2ac6('0x17')](_0x3b0b9d){if(!this[_0x2ac6('0xa')]['has'](_0x3b0b9d))throw new _0x3ba4f2('annotationsuis-missing-ui',this,{'uiName':_0x3b0b9d});const _0x29a617=this[_0x2ac6('0x2a')][_0x2ac6('0x10')][_0x2ac6('0x25')](_0x306da9),_0x21c533=Array[_0x2ac6('0x3')](_0x29a617[_0x2ac6('0x26')])[0x0]||null;this[_0x2ac6('0x1c')](),this[_0x2ac6('0xe')](_0x3b0b9d);const _0x3cf37b=this[_0x2ac6('0xa')]['get'](_0x3b0b9d);_0x3cf37b[_0x2ac6('0x14')](_0x21c533),_0x3cf37b['_setSelectedAnnotations']&&_0x21c533&&_0x3cf37b[_0x2ac6('0x24')]([_0x21c533]);}[_0x2ac6('0x1c')](){for(const _0x2b333f of this[_0x2ac6('0x21')])this[_0x2ac6('0x28')](_0x2b333f);}[_0x2ac6('0x13')](_0x39edf4,_0x324251){if(this[_0x2ac6('0xa')]['has'](_0x39edf4))throw new _0x3ba4f2(_0x2ac6('0x29'));if('function'!=typeof _0x324251['attach']||_0x2ac6('0x1a')!=typeof _0x324251['detach']||_0x2ac6('0x1a')!=typeof _0x324251[_0x2ac6('0x14')])throw new _0x3ba4f2('annotationsuis-register-invalid-interface',null);this[_0x2ac6('0xa')][_0x2ac6('0x22')](_0x39edf4,_0x324251);}[_0x2ac6('0x9')](){const _0x31d7b1=this[_0x2ac6('0x2a')][_0x2ac6('0x10')]['get'](_0x306da9)['collection'],_0x26475f=new Map(),_0x3487cd=Array['from'](this[_0x2ac6('0x21')]);for(const _0x50766a of this[_0x2ac6('0x21')]){const _0x35fe24=this[_0x2ac6('0x0')][_0x2ac6('0x25')](_0x50766a)[_0x2ac6('0xb')];for(const _0x5a0acf of _0x35fe24)_0x26475f[_0x2ac6('0x22')](_0x5a0acf,_0x50766a);}for(const _0x10807c of _0x31d7b1){const _0x2f9a80=_0x26475f[_0x2ac6('0x25')](_0x10807c);this['_assertAnnotationDoesNotBelongToMultipleUIs'](_0x10807c);const _0x74043f=_0x3487cd[_0x2ac6('0x12')](_0x5ac4af=>this[_0x2ac6('0x0')][_0x2ac6('0x25')](_0x5ac4af)[_0x2ac6('0x5')](_0x10807c));_0x2f9a80!==_0x74043f&&(_0x2f9a80&&this[_0x2ac6('0x0')][_0x2ac6('0x25')](_0x2f9a80)[_0x2ac6('0xb')][_0x2ac6('0x2c')](_0x10807c),_0x74043f&&this[_0x2ac6('0x0')]['get'](_0x74043f)['collection']['add'](_0x10807c));}}[_0x2ac6('0xd')](){this[_0x2ac6('0x1c')](),super[_0x2ac6('0xd')]();}[_0x2ac6('0x20')](_0xa28c0c){const _0xccd752=[];for(const _0x2216db of this['activeUIs']){(0x0,this['_uisData'][_0x2ac6('0x25')](_0x2216db)[_0x2ac6('0x5')])(_0xa28c0c)&&_0xccd752[_0x2ac6('0x1e')](_0x2216db);}if(_0xccd752['length']>0x1)throw new _0x3ba4f2(_0x2ac6('0x23'),null,{'matchedUIs':_0xccd752,'annotationType':_0xa28c0c[_0x2ac6('0x8')]});}}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module comments/annotations/editorannotations
|
|
3
|
+
* @publicApi
|
|
4
|
+
*/
|
|
5
|
+
import { Plugin, type PluginDependencies, type Editor } from 'ckeditor5/src/core';
|
|
6
|
+
import type Annotation from './annotation';
|
|
7
|
+
import type AnnotationCollection from './annotationcollection';
|
|
8
|
+
/**
|
|
9
|
+
* Integrates {@link module:comments/annotations/annotations~Annotations annotations} with the editor to provide proper behavior
|
|
10
|
+
* for annotations created through the editor features.
|
|
11
|
+
*
|
|
12
|
+
* *Note: The API of this class might change in the near future.*
|
|
13
|
+
*
|
|
14
|
+
* Collects all types of the annotations created through the editor features and their markers and decides which annotation is currently
|
|
15
|
+
* selected by the selection.
|
|
16
|
+
*
|
|
17
|
+
* Every editor plugin that adds an annotation should also
|
|
18
|
+
* {@link module:comments/annotations/editorannotations~EditorAnnotations#addSourceCollector register a callback}
|
|
19
|
+
* in which it will check whether given annotation should be marked as selected.
|
|
20
|
+
*/
|
|
21
|
+
export default class EditorAnnotations extends Plugin {
|
|
22
|
+
/**
|
|
23
|
+
* @inheritDoc
|
|
24
|
+
*/
|
|
25
|
+
static get requires(): PluginDependencies;
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
static get pluginName(): 'EditorAnnotations';
|
|
30
|
+
/**
|
|
31
|
+
* @inheritDoc
|
|
32
|
+
*/
|
|
33
|
+
constructor(editor: Editor);
|
|
34
|
+
/**
|
|
35
|
+
* @inheritDoc
|
|
36
|
+
*/
|
|
37
|
+
init(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Registers given annotation as an editor annotation, that is an annotation that is linked with a target inside the editor content.
|
|
40
|
+
*/
|
|
41
|
+
registerAnnotation(annotation: Annotation): void;
|
|
42
|
+
hasDomSelection(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Registers a callback that collects annotations and their markers.
|
|
45
|
+
*/
|
|
46
|
+
addSourceCollector(callback: Function): void;
|
|
47
|
+
/**
|
|
48
|
+
* Finds all annotations selected by the editor selection and marks the most inner one as the active annotation.
|
|
49
|
+
*/
|
|
50
|
+
refreshSelectedViews(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Finds all annotations for selected markers in order from the most inner marker to the most outer marker.
|
|
53
|
+
*
|
|
54
|
+
* @param options.annotations The collection of annotations for given UI.
|
|
55
|
+
* @param options.activeAnnotation The given UI active annotation.
|
|
56
|
+
* It is used to determine the order if the selection contains the active annotation's marker.
|
|
57
|
+
*/
|
|
58
|
+
getOrderedSelectedAnnotations({ activeAnnotation, annotations }: {
|
|
59
|
+
activeAnnotation: Annotation | null;
|
|
60
|
+
annotations: AnnotationCollection;
|
|
61
|
+
}): Array<Annotation>;
|
|
62
|
+
}
|
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x5aaa=['_editorAnnotationsData','hasDomSelection','sort','has','change:isFocused','editorannotations-invalid-source-callback','set','change:range','getOrderedSelectedAnnotations','add','remove','refreshSelectedViews','document','requires','_editorAnnotations','push','blur','_dataCollectors','fire','registerAnnotation','range','editing','refresh','cancel','view','map','listenTo','editor','containsRange','directChange','annotation','getRanges','collection','function','pluginName','addSourceCollector','isEqual','delete','model','getByInnerView','focusTracker','isCollapsed','plugins','selection'];(function(_0x211fe6,_0x5aaa67){const _0x345fca=function(_0x43886c){while(--_0x43886c){_0x211fe6['push'](_0x211fe6['shift']());}};_0x345fca(++_0x5aaa67);}(_0x5aaa,0xef));const _0x345f=function(_0x211fe6,_0x5aaa67){_0x211fe6=_0x211fe6-0x0;let _0x345fca=_0x5aaa[_0x211fe6];return _0x345fca;};import{Plugin as _0x4e4a8f}from'ckeditor5/src/core';import{CKEditorError as _0x5ce7cc}from'ckeditor5/src/utils';import{debounce as _0x4ab039}from'lodash-es';import _0xeeff55 from'./annotations';export default class k extends _0x4e4a8f{static get[_0x345f('0x26')](){return[_0xeeff55];}static get[_0x345f('0xf')](){return'EditorAnnotations';}constructor(_0x1e128d){super(_0x1e128d),this[_0x345f('0x2a')]=new Set(),this[_0x345f('0x27')]=new Set();}['init'](){const _0x3888e3=this[_0x345f('0x8')],_0x1a8663=_0x3888e3[_0x345f('0x13')][_0x345f('0x25')][_0x345f('0x18')],_0x22869e=_0x4ab039(()=>this[_0x345f('0x24')](),0xa);_0x1a8663['on'](_0x345f('0x20'),(_0x4591e3,_0x29d672)=>{_0x29d672[_0x345f('0xa')]&&(_0x22869e[_0x345f('0x4')](),this['refreshSelectedViews']());}),this[_0x345f('0x7')](_0x3888e3[_0x345f('0x2')][_0x345f('0x5')][_0x345f('0x25')],_0x345f('0x1d'),(_0x283475,_0x48ecd0,_0xec54f8)=>{_0xec54f8&&_0x22869e();}),this[_0x345f('0x7')](_0x3888e3['ui'][_0x345f('0x15')],_0x345f('0x1d'),(_0x3d3ff1,_0x581def,_0x57a73f)=>{_0x57a73f||_0x3888e3['isReadOnly']||this[_0x345f('0x2b')](_0x345f('0x29'),{'isAnnotationTracked':_0x178809=>this[_0x345f('0x19')][_0x345f('0x1c')](_0x178809['innerView'])});}),this[_0x345f('0x7')](this[_0x345f('0x8')]['ui'],'update',()=>this[_0x345f('0x2b')]('uiUpdate'));}[_0x345f('0x0')](_0x915825){if(this[_0x345f('0x27')][_0x345f('0x1c')](_0x915825['view']))return;this[_0x345f('0x27')][_0x345f('0x22')](_0x915825[_0x345f('0x5')]),this[_0x345f('0x8')]['ui']['focusTracker'][_0x345f('0x22')](_0x915825['view']['element']);const _0x5d156d=this[_0x345f('0x8')][_0x345f('0x17')]['get'](_0xeeff55);this['listenTo'](_0x5d156d[_0x345f('0xd')],_0x345f('0x23'),(_0x23f35a,_0x2e31b2)=>{this[_0x345f('0x8')]['ui']['focusTracker'][_0x345f('0x23')](_0x2e31b2[_0x345f('0x5')]['element']),this['_editorAnnotations'][_0x345f('0x12')](_0x2e31b2[_0x345f('0x5')]);});}['hasDomSelection'](){return this[_0x345f('0x8')]['editing'][_0x345f('0x5')][_0x345f('0x1a')];}[_0x345f('0x10')](_0x1bd9c1){if(_0x345f('0xe')!=typeof _0x1bd9c1)throw new _0x5ce7cc(_0x345f('0x1e'));this[_0x345f('0x2a')][_0x345f('0x22')](_0x1bd9c1);}[_0x345f('0x24')](){this[_0x345f('0x2b')](_0x345f('0x3'));}[_0x345f('0x21')]({activeAnnotation:_0x274dc5,annotations:_0x3a0a44}){const _0x4ba91d=[],_0x2f52ff=this[_0x345f('0x8')]['model'][_0x345f('0x25')][_0x345f('0x18')],_0x6af06=Array['from'](_0x2f52ff[_0x345f('0xc')]());for(const [_0x5e07a5,_0x2f02d4]of this[_0x345f('0x19')]){const _0x8a65cb=_0x29016f(_0x2f02d4),_0x3ff766=_0x3a0a44[_0x345f('0x14')](_0x5e07a5);_0x8a65cb&&_0x3ff766&&_0x4ba91d[_0x345f('0x28')]({'annotation':_0x3ff766,'range':_0x8a65cb});}function _0x29016f(_0x39d558){for(const _0x2b56d6 of _0x39d558)for(const _0x2081ce of _0x6af06)if(_0x2b56d6[_0x345f('0x9')](_0x2081ce,!_0x2f52ff[_0x345f('0x16')]))return _0x2b56d6;return null;}return _0x4ba91d[_0x345f('0x1b')]((_0xc91ac9,_0x2a4aae)=>{const _0x1c3c40=_0xc91ac9[_0x345f('0x1')],_0x2ca9af=_0x2a4aae['range'];if(!_0x1c3c40[_0x345f('0x11')](_0x2ca9af)){if(_0x1c3c40[_0x345f('0x9')](_0x2ca9af,!0x0))return 0x1;if(_0x2ca9af[_0x345f('0x9')](_0x1c3c40,!0x0))return-0x1;}return _0xc91ac9[_0x345f('0xb')]==_0x274dc5?-0x1:_0x2a4aae[_0x345f('0xb')]==_0x274dc5?0x1:0x0;})[_0x345f('0x6')](_0x5ea4e3=>_0x5ea4e3[_0x345f('0xb')]);}get[_0x345f('0x19')](){const _0x4740c6=new Map();for(const _0x3ddc3a of Array['from'](this[_0x345f('0x2a')]))for(const [_0x2850f7,_0x24f955]of _0x3ddc3a())_0x4740c6[_0x345f('0x1f')](_0x2850f7,_0x24f955);return _0x4740c6;}}
|