@ckeditor/ckeditor5-comments 36.0.0 → 37.0.0-rc.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 +20 -4
- 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 _0x491a=['pluginName','refreshVisibility','remove','Annotations','_removeActiveAnnotation','deactivateAll','stopListening','add','change:isVisible','refreshPositioning','_visibleAnnotations','isVisible','element','_addActiveAnnotation','_activateAnnotation','fire','view','destroy','listenTo','_deactivateAllAnnotations','collection','getByInnerView','source','has','activate','activeAnnotations'];(function(_0x53a3b9,_0x491ac8){const _0x3b9b09=function(_0x4a29ea){while(--_0x4a29ea){_0x53a3b9['push'](_0x53a3b9['shift']());}};_0x3b9b09(++_0x491ac8);}(_0x491a,0x1c3));const _0x3b9b=function(_0x53a3b9,_0x491ac8){_0x53a3b9=_0x53a3b9-0x0;let _0x3b9b09=_0x491a[_0x53a3b9];return _0x3b9b09;};import{ContextPlugin as _0x59d1ff}from'ckeditor5/src/core';import _0x1d2878 from'./annotation';import _0x1e97db from'./annotationcollection';import _0x5c4aad from'./view/annotationview';export default class b extends _0x59d1ff{static get[_0x3b9b('0x11')](){return _0x3b9b('0x14');}constructor(_0x11b7eb){super(_0x11b7eb),this[_0x3b9b('0xb')]=new _0x1e97db(),this[_0x3b9b('0x1')]=new _0x1e97db(),this['set'](_0x3b9b('0x10'),new Set()),this['_bindAnnotationsToVisibleAnnotations']();}[_0x3b9b('0x18')](_0x57984f){this[_0x3b9b('0xb')][_0x3b9b('0x18')](_0x57984f);}['remove'](_0x2f6e91){this['collection'][_0x3b9b('0x13')](_0x2f6e91),_0x2f6e91[_0x3b9b('0x8')]();}['refreshVisibility'](){for(const _0x168c0a of this[_0x3b9b('0xb')])_0x168c0a[_0x3b9b('0x12')]();}[_0x3b9b('0x0')](){this[_0x3b9b('0x1')][_0x3b9b('0x0')]();}[_0x3b9b('0xc')](_0x324fd0){return this[_0x3b9b('0xb')][_0x3b9b('0xc')](_0x324fd0);}[_0x3b9b('0x16')](){this[_0x3b9b('0x6')](_0x3b9b('0xa'));}['destroy'](){for(const _0x2d1640 of this[_0x3b9b('0xb')])_0x2d1640[_0x3b9b('0x8')]();this[_0x3b9b('0x1')][_0x3b9b('0x8')](),this['collection'][_0x3b9b('0x8')](),super['destroy']();}[_0x3b9b('0xf')](_0x239c19){this[_0x3b9b('0x6')](_0x3b9b('0x5'),_0x239c19);}['createAnnotation'](_0x26acfc){return new _0x1d2878(_0x26acfc);}['createAnnotationView'](_0x17b921,_0x226db9){return new _0x5c4aad(_0x17b921,_0x226db9);}[_0x3b9b('0x4')](_0x58829b){const _0x25059d=new Set(this[_0x3b9b('0x10')]);_0x25059d[_0x3b9b('0x18')](_0x58829b),this[_0x3b9b('0x10')]=_0x25059d;}[_0x3b9b('0x15')](_0x78bbf3){const _0x575cec=new Set(this[_0x3b9b('0x10')]);_0x575cec['delete'](_0x78bbf3),this['activeAnnotations']=_0x575cec;}['_bindAnnotationsToVisibleAnnotations'](){const _0x42900b=this[_0x3b9b('0xb')],_0x29f9e9=this[_0x3b9b('0x1')];function _0x560870(_0x1ff2a0){const _0x14fa66=_0x1ff2a0[_0x3b9b('0xd')];_0x14fa66[_0x3b9b('0x2')]&&!_0x29f9e9[_0x3b9b('0xe')](_0x14fa66)?_0x29f9e9[_0x3b9b('0x18')](_0x14fa66):!_0x14fa66[_0x3b9b('0x2')]&&_0x29f9e9[_0x3b9b('0xe')](_0x14fa66)&&_0x29f9e9[_0x3b9b('0x13')](_0x14fa66),_0x14fa66['view']['focusTracker'][_0x3b9b('0x13')](_0x14fa66[_0x3b9b('0x7')][_0x3b9b('0x3')]),_0x14fa66[_0x3b9b('0x7')]['focusTracker']['add'](_0x14fa66['view'][_0x3b9b('0x3')]);}this['listenTo'](_0x42900b,_0x3b9b('0x18'),(_0x1f7d0d,_0x2c75b5)=>{_0x2c75b5['isVisible']&&_0x29f9e9[_0x3b9b('0x18')](_0x2c75b5),this['listenTo'](_0x2c75b5,_0x3b9b('0x19'),_0x560870);}),this[_0x3b9b('0x9')](_0x42900b,_0x3b9b('0x13'),(_0x4ed42b,_0x200467)=>{_0x29f9e9['has'](_0x200467)&&_0x29f9e9[_0x3b9b('0x13')](_0x200467),this[_0x3b9b('0x17')](_0x200467,_0x3b9b('0x19'),_0x560870);});}}
|
|
@@ -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 _0x3e8c=['change:activeAnnotation','get','annotationsuis-annotation-mismatch','AnnotationsUIs','annotationsuis-register-invalid-interface','isActive','refilterAnnotations','_visibleAnnotations','find','listenTo','setActiveAnnotation','size','deactivateAll','filter','hasActive','activeAnnotations','_activateAnnotation','_uis','from','activate','annotationsuis-missing-ui','init','function','push','annotationsuis-register-already-registered','stopListening','collection','deactivate','pluginName','attach','length','destroy','has','activeUIs','set','type','add','context','detach','delete','_assertAnnotationDoesNotBelongToMultipleUIs','plugins','_setSelectedAnnotations','register','_deactivateAllAnnotations','_uisData'];(function(_0x6f9690,_0x3e8c82){const _0x5d7eac=function(_0xe605da){while(--_0xe605da){_0x6f9690['push'](_0x6f9690['shift']());}};_0x5d7eac(++_0x3e8c82);}(_0x3e8c,0x81));const _0x5d7e=function(_0x6f9690,_0x3e8c82){_0x6f9690=_0x6f9690-0x0;let _0x5d7eac=_0x3e8c[_0x6f9690];return _0x5d7eac;};import{ContextPlugin as _0x1e9bb8}from'ckeditor5/src/core';import{CKEditorError as _0x1a45d6}from'ckeditor5/src/utils';import _0xee8372,{bindAnnotationCollections as _0x4f41d9}from'./annotationcollection';import _0x442de0 from'./annotations';export default class M extends _0x1e9bb8{static get['requires'](){return[_0x442de0];}static get[_0x5d7e('0x25')](){return _0x5d7e('0xc');}constructor(_0x489912){super(_0x489912),this[_0x5d7e('0x2a')]=new Set(),this['_uis']=new Map(),this[_0x5d7e('0x8')]=new Map();}[_0x5d7e('0x1e')](){const _0x34abec=this[_0x5d7e('0x0')]['plugins'][_0x5d7e('0xa')](_0x442de0);this[_0x5d7e('0x12')](_0x34abec,_0x5d7e('0x19'),(_0xc79007,_0x42a938)=>{for(const _0x5f03ee of this[_0x5d7e('0x2a')]){const _0x3ad975=this[_0x5d7e('0x1a')][_0x5d7e('0xa')](_0x5f03ee);(0x0,this[_0x5d7e('0x8')][_0x5d7e('0xa')](_0x5f03ee)['filter'])(_0x42a938)&&_0x3ad975[_0x5d7e('0x13')](_0x42a938);}}),this['listenTo'](_0x34abec,_0x5d7e('0x7'),()=>{for(const _0x2f0040 of this['activeUIs']){this['_uis'][_0x5d7e('0xa')](_0x2f0040)[_0x5d7e('0x13')](null);}}),this['listenTo'](_0x34abec['_visibleAnnotations'],_0x5d7e('0x2d'),(_0x58db70,_0x33535f)=>{this[_0x5d7e('0x3')](_0x33535f);});}[_0x5d7e('0x17')](){return this[_0x5d7e('0x2a')][_0x5d7e('0x14')]>0x0;}[_0x5d7e('0xe')](_0x175a83){return this[_0x5d7e('0x2a')][_0x5d7e('0x29')](_0x175a83);}[_0x5d7e('0x1c')](_0x58a41e,_0x26923f=()=>!0x0){const _0x12d253=this[_0x5d7e('0x0')][_0x5d7e('0x4')][_0x5d7e('0xa')](_0x442de0);if(!this[_0x5d7e('0x1a')][_0x5d7e('0x29')](_0x58a41e))throw new _0x1a45d6(_0x5d7e('0x1d'),this,{'uiName':_0x58a41e});this[_0x5d7e('0xe')](_0x58a41e)&&this[_0x5d7e('0x24')](_0x58a41e),this['activeUIs']['add'](_0x58a41e);const _0x26b739=new _0xee8372(),_0x17715f=_0x12d253[_0x5d7e('0x10')];_0x4f41d9({'source':_0x17715f,'target':_0x26b739,'filter':_0x26923f}),this[_0x5d7e('0x8')][_0x5d7e('0x2b')](_0x58a41e,{'collection':_0x26b739,'filter':_0x26923f});const _0x56c9cb=this[_0x5d7e('0x1a')][_0x5d7e('0xa')](_0x58a41e);_0x56c9cb[_0x5d7e('0x26')](_0x26b739),this['listenTo'](_0x56c9cb,_0x5d7e('0x9'),(_0x230199,_0x1ab1c7,_0x3758d8,_0x51ef7f)=>{_0x51ef7f&&_0x12d253['_removeActiveAnnotation'](_0x51ef7f),_0x3758d8&&_0x12d253['_addActiveAnnotation'](_0x3758d8);});}[_0x5d7e('0x24')](_0x5c435f){if(this['activeUIs'][_0x5d7e('0x2')](_0x5c435f),!this[_0x5d7e('0x1a')][_0x5d7e('0x29')](_0x5c435f))throw new _0x1a45d6(_0x5d7e('0x1d'),this,{'uiName':_0x5c435f});const _0xc4cc3a=this['_uis'][_0x5d7e('0xa')](_0x5c435f);_0xc4cc3a['detach'](),this[_0x5d7e('0x22')](_0xc4cc3a),this[_0x5d7e('0x8')][_0x5d7e('0xa')](_0x5c435f)[_0x5d7e('0x23')][_0x5d7e('0x28')](),this['_uisData'][_0x5d7e('0x2')](_0x5c435f);}['switchTo'](_0x27eada){if(!this[_0x5d7e('0x1a')][_0x5d7e('0x29')](_0x27eada))throw new _0x1a45d6('annotationsuis-missing-ui',this,{'uiName':_0x27eada});const _0x677ac1=this[_0x5d7e('0x0')][_0x5d7e('0x4')][_0x5d7e('0xa')](_0x442de0),_0x531df0=Array[_0x5d7e('0x1b')](_0x677ac1[_0x5d7e('0x18')])[0x0]||null;this[_0x5d7e('0x15')](),this[_0x5d7e('0x1c')](_0x27eada);const _0x13b440=this[_0x5d7e('0x1a')]['get'](_0x27eada);_0x13b440[_0x5d7e('0x13')](_0x531df0),_0x13b440[_0x5d7e('0x5')]&&_0x531df0&&_0x13b440[_0x5d7e('0x5')]([_0x531df0]);}['deactivateAll'](){for(const _0x3a3efa of this[_0x5d7e('0x2a')])this[_0x5d7e('0x24')](_0x3a3efa);}[_0x5d7e('0x6')](_0x1b1c66,_0x129b90){if(this[_0x5d7e('0x1a')][_0x5d7e('0x29')](_0x1b1c66))throw new _0x1a45d6(_0x5d7e('0x21'));if(_0x5d7e('0x1f')!=typeof _0x129b90[_0x5d7e('0x26')]||_0x5d7e('0x1f')!=typeof _0x129b90[_0x5d7e('0x1')]||_0x5d7e('0x1f')!=typeof _0x129b90['setActiveAnnotation'])throw new _0x1a45d6(_0x5d7e('0xd'),null);this[_0x5d7e('0x1a')]['set'](_0x1b1c66,_0x129b90);}[_0x5d7e('0xf')](){const _0x34a016=this[_0x5d7e('0x0')]['plugins']['get'](_0x442de0)[_0x5d7e('0x23')],_0x1f213a=new Map(),_0x566e2c=Array[_0x5d7e('0x1b')](this[_0x5d7e('0x2a')]);for(const _0x3fade1 of this[_0x5d7e('0x2a')]){const _0x28e03c=this[_0x5d7e('0x8')]['get'](_0x3fade1)[_0x5d7e('0x23')];for(const _0x2a0638 of _0x28e03c)_0x1f213a[_0x5d7e('0x2b')](_0x2a0638,_0x3fade1);}for(const _0x1a7c71 of _0x34a016){const _0x5c01c8=_0x1f213a[_0x5d7e('0xa')](_0x1a7c71);this[_0x5d7e('0x3')](_0x1a7c71);const _0x117b02=_0x566e2c[_0x5d7e('0x11')](_0x57d67c=>this[_0x5d7e('0x8')][_0x5d7e('0xa')](_0x57d67c)[_0x5d7e('0x16')](_0x1a7c71));_0x5c01c8!==_0x117b02&&(_0x5c01c8&&this[_0x5d7e('0x8')]['get'](_0x5c01c8)['collection']['remove'](_0x1a7c71),_0x117b02&&this[_0x5d7e('0x8')][_0x5d7e('0xa')](_0x117b02)[_0x5d7e('0x23')][_0x5d7e('0x2d')](_0x1a7c71));}}[_0x5d7e('0x28')](){this[_0x5d7e('0x15')](),super[_0x5d7e('0x28')]();}[_0x5d7e('0x3')](_0x2e025b){const _0x266aec=[];for(const _0x330883 of this[_0x5d7e('0x2a')]){(0x0,this[_0x5d7e('0x8')]['get'](_0x330883)['filter'])(_0x2e025b)&&_0x266aec[_0x5d7e('0x20')](_0x330883);}if(_0x266aec[_0x5d7e('0x27')]>0x1)throw new _0x1a45d6(_0x5d7e('0xb'),null,{'matchedUIs':_0x266aec,'annotationType':_0x2e025b[_0x5d7e('0x2c')]});}}
|
|
@@ -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 _0x4cdb=['getRanges','model','annotation','hasDomSelection','refreshSelectedViews','pluginName','change:range','remove','requires','registerAnnotation','directChange','addSourceCollector','uiUpdate','selection','cancel','listenTo','editorannotations-invalid-source-callback','sort','fire','document','_dataCollectors','view','delete','collection','refresh','isCollapsed','element','init','has','range','_editorAnnotations','editor','update','EditorAnnotations','function','editing','blur','isEqual','from','containsRange','focusTracker','_editorAnnotationsData','plugins','add'];(function(_0x10e3ff,_0x4cdb8a){const _0x2076cf=function(_0x3839c4){while(--_0x3839c4){_0x10e3ff['push'](_0x10e3ff['shift']());}};_0x2076cf(++_0x4cdb8a);}(_0x4cdb,0xaa));const _0x2076=function(_0x10e3ff,_0x4cdb8a){_0x10e3ff=_0x10e3ff-0x0;let _0x2076cf=_0x4cdb[_0x10e3ff];return _0x2076cf;};import{Plugin as _0x42a95c}from'ckeditor5/src/core';import{CKEditorError as _0x16c200}from'ckeditor5/src/utils';import{debounce as _0x1d3262}from'lodash-es';import _0x16e8f6 from'./annotations';export default class k extends _0x42a95c{static get[_0x2076('0xe')](){return[_0x16e8f6];}static get[_0x2076('0xb')](){return _0x2076('0x27');}constructor(_0x53a8c3){super(_0x53a8c3),this['_dataCollectors']=new Set(),this[_0x2076('0x24')]=new Set();}[_0x2076('0x21')](){const _0x21708d=this[_0x2076('0x25')],_0x5af893=_0x21708d[_0x2076('0x7')]['document'][_0x2076('0x13')],_0x464bcd=_0x1d3262(()=>this[_0x2076('0xa')](),0xa);_0x5af893['on'](_0x2076('0xc'),(_0x3d4405,_0x349840)=>{_0x349840[_0x2076('0x10')]&&(_0x464bcd[_0x2076('0x14')](),this[_0x2076('0xa')]());}),this[_0x2076('0x15')](_0x21708d[_0x2076('0x29')][_0x2076('0x1b')]['document'],'change:isFocused',(_0x30632b,_0x5604e1,_0x2b1c5c)=>{_0x2b1c5c&&_0x464bcd();}),this[_0x2076('0x15')](_0x21708d['ui'][_0x2076('0x2')],'change:isFocused',(_0x178971,_0x236be2,_0x1cca44)=>{_0x1cca44||_0x21708d['isReadOnly']||this['fire'](_0x2076('0x2a'),{'isAnnotationTracked':_0x572f5d=>this[_0x2076('0x3')][_0x2076('0x22')](_0x572f5d['innerView'])});}),this[_0x2076('0x15')](this['editor']['ui'],_0x2076('0x26'),()=>this[_0x2076('0x18')](_0x2076('0x12')));}[_0x2076('0xf')](_0x2c3985){if(this['_editorAnnotations'][_0x2076('0x22')](_0x2c3985[_0x2076('0x1b')]))return;this['_editorAnnotations'][_0x2076('0x5')](_0x2c3985['view']),this['editor']['ui'][_0x2076('0x2')][_0x2076('0x5')](_0x2c3985[_0x2076('0x1b')]['element']);const _0x50acab=this[_0x2076('0x25')][_0x2076('0x4')]['get'](_0x16e8f6);this[_0x2076('0x15')](_0x50acab[_0x2076('0x1d')],_0x2076('0xd'),(_0x241f98,_0x40705f)=>{this[_0x2076('0x25')]['ui'][_0x2076('0x2')][_0x2076('0xd')](_0x40705f['view'][_0x2076('0x20')]),this[_0x2076('0x24')][_0x2076('0x1c')](_0x40705f[_0x2076('0x1b')]);});}[_0x2076('0x9')](){return this[_0x2076('0x25')]['editing'][_0x2076('0x1b')]['hasDomSelection'];}[_0x2076('0x11')](_0x444108){if(_0x2076('0x28')!=typeof _0x444108)throw new _0x16c200(_0x2076('0x16'));this[_0x2076('0x1a')][_0x2076('0x5')](_0x444108);}['refreshSelectedViews'](){this[_0x2076('0x18')](_0x2076('0x1e'));}['getOrderedSelectedAnnotations']({activeAnnotation:_0x2bc608,annotations:_0x259879}){const _0x23137d=[],_0x39b943=this[_0x2076('0x25')]['model'][_0x2076('0x19')]['selection'],_0x22f6ed=Array[_0x2076('0x0')](_0x39b943[_0x2076('0x6')]());for(const [_0x1ab604,_0xd83149]of this[_0x2076('0x3')]){const _0x4b3e54=_0xcdfd55(_0xd83149),_0x1ae01e=_0x259879['getByInnerView'](_0x1ab604);_0x4b3e54&&_0x1ae01e&&_0x23137d['push']({'annotation':_0x1ae01e,'range':_0x4b3e54});}function _0xcdfd55(_0x5d28bd){for(const _0x588a52 of _0x5d28bd)for(const _0x35596b of _0x22f6ed)if(_0x588a52['containsRange'](_0x35596b,!_0x39b943[_0x2076('0x1f')]))return _0x588a52;return null;}return _0x23137d[_0x2076('0x17')]((_0x2e4f90,_0x124436)=>{const _0x38abf0=_0x2e4f90[_0x2076('0x23')],_0x48b3fb=_0x124436[_0x2076('0x23')];if(!_0x38abf0[_0x2076('0x2b')](_0x48b3fb)){if(_0x38abf0[_0x2076('0x1')](_0x48b3fb,!0x0))return 0x1;if(_0x48b3fb[_0x2076('0x1')](_0x38abf0,!0x0))return-0x1;}return _0x2e4f90[_0x2076('0x8')]==_0x2bc608?-0x1:_0x124436[_0x2076('0x8')]==_0x2bc608?0x1:0x0;})['map'](_0x1e3ca2=>_0x1e3ca2[_0x2076('0x8')]);}get[_0x2076('0x3')](){const _0x465407=new Map();for(const _0x28df52 of Array[_0x2076('0x0')](this[_0x2076('0x1a')]))for(const [_0x1da194,_0xa3df59]of _0x28df52())_0x465407['set'](_0x1da194,_0xa3df59);return _0x465407;}}
|