@ckeditor/ckeditor5-comments 41.3.1 → 41.4.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.
Files changed (265) hide show
  1. package/build/comments.js +1 -1
  2. package/build/translations/ti.js +1 -0
  3. package/dist/index-content.css +4 -0
  4. package/dist/index-editor.css +596 -0
  5. package/dist/index.css +990 -0
  6. package/dist/index.js +23 -0
  7. package/dist/translations/af.d.ts +8 -0
  8. package/dist/translations/af.js +23 -0
  9. package/dist/translations/af.umd.js +23 -0
  10. package/dist/translations/ar.d.ts +8 -0
  11. package/dist/translations/ar.js +23 -0
  12. package/dist/translations/ar.umd.js +23 -0
  13. package/dist/translations/bg.d.ts +8 -0
  14. package/dist/translations/bg.js +23 -0
  15. package/dist/translations/bg.umd.js +23 -0
  16. package/dist/translations/bn.d.ts +8 -0
  17. package/dist/translations/bn.js +23 -0
  18. package/dist/translations/bn.umd.js +23 -0
  19. package/dist/translations/bs.d.ts +8 -0
  20. package/dist/translations/bs.js +23 -0
  21. package/dist/translations/bs.umd.js +23 -0
  22. package/dist/translations/ca.d.ts +8 -0
  23. package/dist/translations/ca.js +23 -0
  24. package/dist/translations/ca.umd.js +23 -0
  25. package/dist/translations/cs.d.ts +8 -0
  26. package/dist/translations/cs.js +23 -0
  27. package/dist/translations/cs.umd.js +23 -0
  28. package/dist/translations/da.d.ts +8 -0
  29. package/dist/translations/da.js +23 -0
  30. package/dist/translations/da.umd.js +23 -0
  31. package/dist/translations/de-ch.d.ts +8 -0
  32. package/dist/translations/de-ch.js +23 -0
  33. package/dist/translations/de-ch.umd.js +23 -0
  34. package/dist/translations/de.d.ts +8 -0
  35. package/dist/translations/de.js +23 -0
  36. package/dist/translations/de.umd.js +23 -0
  37. package/dist/translations/el.d.ts +8 -0
  38. package/dist/translations/el.js +23 -0
  39. package/dist/translations/el.umd.js +23 -0
  40. package/dist/translations/en-au.d.ts +8 -0
  41. package/dist/translations/en-au.js +23 -0
  42. package/dist/translations/en-au.umd.js +23 -0
  43. package/dist/translations/en.d.ts +8 -0
  44. package/dist/translations/en.js +23 -0
  45. package/dist/translations/en.umd.js +23 -0
  46. package/dist/translations/es-co.d.ts +8 -0
  47. package/dist/translations/es-co.js +23 -0
  48. package/dist/translations/es-co.umd.js +23 -0
  49. package/dist/translations/es.d.ts +8 -0
  50. package/dist/translations/es.js +23 -0
  51. package/dist/translations/es.umd.js +23 -0
  52. package/dist/translations/et.d.ts +8 -0
  53. package/dist/translations/et.js +23 -0
  54. package/dist/translations/et.umd.js +23 -0
  55. package/dist/translations/fa.d.ts +8 -0
  56. package/dist/translations/fa.js +23 -0
  57. package/dist/translations/fa.umd.js +23 -0
  58. package/dist/translations/fi.d.ts +8 -0
  59. package/dist/translations/fi.js +23 -0
  60. package/dist/translations/fi.umd.js +23 -0
  61. package/dist/translations/fr.d.ts +8 -0
  62. package/dist/translations/fr.js +23 -0
  63. package/dist/translations/fr.umd.js +23 -0
  64. package/dist/translations/gl.d.ts +8 -0
  65. package/dist/translations/gl.js +23 -0
  66. package/dist/translations/gl.umd.js +23 -0
  67. package/dist/translations/he.d.ts +8 -0
  68. package/dist/translations/he.js +23 -0
  69. package/dist/translations/he.umd.js +23 -0
  70. package/dist/translations/hi.d.ts +8 -0
  71. package/dist/translations/hi.js +23 -0
  72. package/dist/translations/hi.umd.js +23 -0
  73. package/dist/translations/hr.d.ts +8 -0
  74. package/dist/translations/hr.js +23 -0
  75. package/dist/translations/hr.umd.js +23 -0
  76. package/dist/translations/hu.d.ts +8 -0
  77. package/dist/translations/hu.js +23 -0
  78. package/dist/translations/hu.umd.js +23 -0
  79. package/dist/translations/id.d.ts +8 -0
  80. package/dist/translations/id.js +23 -0
  81. package/dist/translations/id.umd.js +23 -0
  82. package/dist/translations/it.d.ts +8 -0
  83. package/dist/translations/it.js +23 -0
  84. package/dist/translations/it.umd.js +23 -0
  85. package/dist/translations/ja.d.ts +8 -0
  86. package/dist/translations/ja.js +23 -0
  87. package/dist/translations/ja.umd.js +23 -0
  88. package/dist/translations/jv.d.ts +8 -0
  89. package/dist/translations/jv.js +23 -0
  90. package/dist/translations/jv.umd.js +23 -0
  91. package/dist/translations/ko.d.ts +8 -0
  92. package/dist/translations/ko.js +23 -0
  93. package/dist/translations/ko.umd.js +23 -0
  94. package/dist/translations/lt.d.ts +8 -0
  95. package/dist/translations/lt.js +23 -0
  96. package/dist/translations/lt.umd.js +23 -0
  97. package/dist/translations/lv.d.ts +8 -0
  98. package/dist/translations/lv.js +23 -0
  99. package/dist/translations/lv.umd.js +23 -0
  100. package/dist/translations/ms.d.ts +8 -0
  101. package/dist/translations/ms.js +23 -0
  102. package/dist/translations/ms.umd.js +23 -0
  103. package/dist/translations/nl.d.ts +8 -0
  104. package/dist/translations/nl.js +23 -0
  105. package/dist/translations/nl.umd.js +23 -0
  106. package/dist/translations/no.d.ts +8 -0
  107. package/dist/translations/no.js +23 -0
  108. package/dist/translations/no.umd.js +23 -0
  109. package/dist/translations/pl.d.ts +8 -0
  110. package/dist/translations/pl.js +23 -0
  111. package/dist/translations/pl.umd.js +23 -0
  112. package/dist/translations/pt-br.d.ts +8 -0
  113. package/dist/translations/pt-br.js +23 -0
  114. package/dist/translations/pt-br.umd.js +23 -0
  115. package/dist/translations/pt.d.ts +8 -0
  116. package/dist/translations/pt.js +23 -0
  117. package/dist/translations/pt.umd.js +23 -0
  118. package/dist/translations/ro.d.ts +8 -0
  119. package/dist/translations/ro.js +23 -0
  120. package/dist/translations/ro.umd.js +23 -0
  121. package/dist/translations/ru.d.ts +8 -0
  122. package/dist/translations/ru.js +23 -0
  123. package/dist/translations/ru.umd.js +23 -0
  124. package/dist/translations/sk.d.ts +8 -0
  125. package/dist/translations/sk.js +23 -0
  126. package/dist/translations/sk.umd.js +23 -0
  127. package/dist/translations/sq.d.ts +8 -0
  128. package/dist/translations/sq.js +23 -0
  129. package/dist/translations/sq.umd.js +23 -0
  130. package/dist/translations/sr-latn.d.ts +8 -0
  131. package/dist/translations/sr-latn.js +23 -0
  132. package/dist/translations/sr-latn.umd.js +23 -0
  133. package/dist/translations/sr.d.ts +8 -0
  134. package/dist/translations/sr.js +23 -0
  135. package/dist/translations/sr.umd.js +23 -0
  136. package/dist/translations/sv.d.ts +8 -0
  137. package/dist/translations/sv.js +23 -0
  138. package/dist/translations/sv.umd.js +23 -0
  139. package/dist/translations/th.d.ts +8 -0
  140. package/dist/translations/th.js +23 -0
  141. package/dist/translations/th.umd.js +23 -0
  142. package/dist/translations/ti.d.ts +8 -0
  143. package/dist/translations/ti.js +23 -0
  144. package/dist/translations/ti.umd.js +23 -0
  145. package/dist/translations/tk.d.ts +8 -0
  146. package/dist/translations/tk.js +23 -0
  147. package/dist/translations/tk.umd.js +23 -0
  148. package/dist/translations/tr.d.ts +8 -0
  149. package/dist/translations/tr.js +23 -0
  150. package/dist/translations/tr.umd.js +23 -0
  151. package/dist/translations/tt.d.ts +8 -0
  152. package/dist/translations/tt.js +23 -0
  153. package/dist/translations/tt.umd.js +23 -0
  154. package/dist/translations/ug.d.ts +8 -0
  155. package/dist/translations/ug.js +23 -0
  156. package/dist/translations/ug.umd.js +23 -0
  157. package/dist/translations/uk.d.ts +8 -0
  158. package/dist/translations/uk.js +23 -0
  159. package/dist/translations/uk.umd.js +23 -0
  160. package/dist/translations/ur.d.ts +8 -0
  161. package/dist/translations/ur.js +23 -0
  162. package/dist/translations/ur.umd.js +23 -0
  163. package/dist/translations/vi.d.ts +8 -0
  164. package/dist/translations/vi.js +23 -0
  165. package/dist/translations/vi.umd.js +23 -0
  166. package/dist/translations/zh-cn.d.ts +8 -0
  167. package/dist/translations/zh-cn.js +23 -0
  168. package/dist/translations/zh-cn.umd.js +23 -0
  169. package/dist/translations/zh.d.ts +8 -0
  170. package/dist/translations/zh.js +23 -0
  171. package/dist/translations/zh.umd.js +23 -0
  172. package/dist/types/annotations/annotation.d.ts +94 -0
  173. package/dist/types/annotations/annotationcollection.d.ts +102 -0
  174. package/dist/types/annotations/annotations.d.ts +158 -0
  175. package/dist/types/annotations/annotationsuis.d.ts +236 -0
  176. package/dist/types/annotations/editorannotations.d.ts +71 -0
  177. package/dist/types/annotations/inlineannotations.d.ts +94 -0
  178. package/dist/types/annotations/narrowsidebar.d.ts +89 -0
  179. package/dist/types/annotations/sidebar.d.ts +104 -0
  180. package/dist/types/annotations/view/annotationcounterbuttonview.d.ts +33 -0
  181. package/dist/types/annotations/view/annotationview.d.ts +94 -0
  182. package/dist/types/annotations/view/sidebaritemview.d.ts +59 -0
  183. package/dist/types/annotations/view/sidebarview.d.ts +36 -0
  184. package/dist/types/annotations/widesidebar.d.ts +81 -0
  185. package/dist/types/augmentation.d.ts +56 -0
  186. package/dist/types/comments/addcommentthreadcommand.d.ts +39 -0
  187. package/dist/types/comments/commentsarchive.d.ts +35 -0
  188. package/dist/types/comments/commentsarchiveui.d.ts +42 -0
  189. package/dist/types/comments/commentsediting.d.ts +84 -0
  190. package/dist/types/comments/commentsrepository.d.ts +1134 -0
  191. package/dist/types/comments/commentsui.d.ts +37 -0
  192. package/dist/types/comments/integrations/clipboard.d.ts +30 -0
  193. package/dist/types/comments/integrations/commentsrestrictededitingmode.d.ts +21 -0
  194. package/dist/types/comments/integrations/importword.d.ts +25 -0
  195. package/dist/types/comments/ui/commenteditor/commenteditor.d.ts +40 -0
  196. package/dist/types/comments/ui/commenteditor/commenteditorui.d.ts +35 -0
  197. package/dist/types/comments/ui/commenteditor/commenteditoruiview.d.ts +40 -0
  198. package/dist/types/comments/ui/commentthreadcontroller.d.ts +68 -0
  199. package/dist/types/comments/ui/view/basecommentthreadview.d.ts +123 -0
  200. package/dist/types/comments/ui/view/basecommentview.d.ts +116 -0
  201. package/dist/types/comments/ui/view/collapsedcommentsview.d.ts +17 -0
  202. package/dist/types/comments/ui/view/commentcontentview.d.ts +18 -0
  203. package/dist/types/comments/ui/view/commentinputview.d.ts +90 -0
  204. package/dist/types/comments/ui/view/commentsarchiveview.d.ts +42 -0
  205. package/dist/types/comments/ui/view/commentslistview.d.ts +104 -0
  206. package/dist/types/comments/ui/view/commentthreadheaderview.d.ts +54 -0
  207. package/dist/types/comments/ui/view/commentthreadinputview.d.ts +45 -0
  208. package/dist/types/comments/ui/view/commentthreadview.d.ts +122 -0
  209. package/dist/types/comments/ui/view/commentview.d.ts +247 -0
  210. package/dist/types/comments.d.ts +39 -0
  211. package/dist/types/commentsonly.d.ts +37 -0
  212. package/dist/types/config.d.ts +202 -0
  213. package/dist/types/index.d.ts +28 -0
  214. package/dist/types/utils/common-translations.d.ts +13 -0
  215. package/dist/types/utils/createmutationobserver.d.ts +18 -0
  216. package/lang/translations/ti.po +120 -0
  217. package/package.json +4 -3
  218. package/src/annotations/annotation.js +1 -1
  219. package/src/annotations/annotationcollection.js +1 -1
  220. package/src/annotations/annotations.js +1 -1
  221. package/src/annotations/annotationsuis.js +1 -1
  222. package/src/annotations/editorannotations.js +1 -1
  223. package/src/annotations/inlineannotations.js +1 -1
  224. package/src/annotations/narrowsidebar.js +1 -1
  225. package/src/annotations/sidebar.js +1 -1
  226. package/src/annotations/view/annotationcounterbuttonview.js +1 -1
  227. package/src/annotations/view/annotationview.js +1 -1
  228. package/src/annotations/view/sidebaritemview.js +1 -1
  229. package/src/annotations/view/sidebarview.js +1 -1
  230. package/src/annotations/widesidebar.js +1 -1
  231. package/src/comments/addcommentthreadcommand.js +1 -1
  232. package/src/comments/commentsarchive.js +1 -1
  233. package/src/comments/commentsarchiveui.js +1 -1
  234. package/src/comments/commentsediting.js +1 -1
  235. package/src/comments/commentsrepository.d.ts +1 -1
  236. package/src/comments/commentsrepository.js +1 -1
  237. package/src/comments/commentsui.js +1 -1
  238. package/src/comments/integrations/clipboard.js +1 -1
  239. package/src/comments/integrations/commentsrestrictededitingmode.js +1 -1
  240. package/src/comments/integrations/importword.js +1 -1
  241. package/src/comments/ui/commenteditor/commenteditor.js +1 -1
  242. package/src/comments/ui/commenteditor/commenteditorui.js +1 -1
  243. package/src/comments/ui/commenteditor/commenteditoruiview.js +1 -1
  244. package/src/comments/ui/commentthreadcontroller.js +1 -1
  245. package/src/comments/ui/view/basecommentthreadview.js +1 -1
  246. package/src/comments/ui/view/basecommentview.js +1 -1
  247. package/src/comments/ui/view/collapsedcommentsview.js +1 -1
  248. package/src/comments/ui/view/commentcontentview.js +1 -1
  249. package/src/comments/ui/view/commentinputview.js +1 -1
  250. package/src/comments/ui/view/commentsarchiveview.js +1 -1
  251. package/src/comments/ui/view/commentslistview.js +1 -1
  252. package/src/comments/ui/view/commentthreadheaderview.js +1 -1
  253. package/src/comments/ui/view/commentthreadinputview.js +1 -1
  254. package/src/comments/ui/view/commentthreadview.js +1 -1
  255. package/src/comments/ui/view/commentview.js +1 -1
  256. package/src/comments.js +1 -1
  257. package/src/commentsonly.js +1 -1
  258. package/src/index.js +1 -1
  259. package/src/utils/common-translations.js +1 -1
  260. package/src/utils/createmutationobserver.js +1 -1
  261. package/theme/annotation.css +13 -0
  262. package/theme/comment.css +4 -0
  263. package/theme/commentinput.css +4 -0
  264. package/theme/commentthread.css +8 -0
  265. package/theme/sidebar.css +8 -0
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module comments/annotations/editorannotations
11
+ * @publicApi
12
+ */
13
+ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
14
+ import Annotations from './annotations.js';
15
+ import type Annotation from './annotation.js';
16
+ import type AnnotationCollection from './annotationcollection.js';
17
+ /**
18
+ * Integrates {@link module:comments/annotations/annotations~Annotations annotations} with the editor to provide proper behavior
19
+ * for annotations created through the editor features.
20
+ *
21
+ * *Note: The API of this class might change in the near future.*
22
+ *
23
+ * Collects all types of the annotations created through the editor features and their markers and decides which annotation is currently
24
+ * selected by the selection.
25
+ *
26
+ * Every editor plugin that adds an annotation should also
27
+ * {@link module:comments/annotations/editorannotations~EditorAnnotations#addSourceCollector register a callback}
28
+ * in which it will check whether given annotation should be marked as selected.
29
+ */
30
+ export default class EditorAnnotations extends Plugin {
31
+ /**
32
+ * @inheritDoc
33
+ */
34
+ static get requires(): readonly [typeof Annotations];
35
+ /**
36
+ * @inheritDoc
37
+ */
38
+ static get pluginName(): "EditorAnnotations";
39
+ /**
40
+ * @inheritDoc
41
+ */
42
+ constructor(editor: Editor);
43
+ /**
44
+ * @inheritDoc
45
+ */
46
+ init(): void;
47
+ /**
48
+ * Registers given annotation as an editor annotation, that is an annotation that is linked with a target inside the editor content.
49
+ */
50
+ registerAnnotation(annotation: Annotation): void;
51
+ hasDomSelection(): boolean;
52
+ /**
53
+ * Registers a callback that collects annotations and their markers.
54
+ */
55
+ addSourceCollector(callback: Function): void;
56
+ /**
57
+ * Finds all annotations selected by the editor selection and marks the most inner one as the active annotation.
58
+ */
59
+ refreshSelectedViews(): void;
60
+ /**
61
+ * Finds all annotations for selected markers in order from the most inner marker to the most outer marker.
62
+ *
63
+ * @param options.annotations The collection of annotations for given UI.
64
+ * @param options.activeAnnotation The given UI active annotation.
65
+ * It is used to determine the order if the selection contains the active annotation's marker.
66
+ */
67
+ getOrderedSelectedAnnotations({ activeAnnotation, annotations }: {
68
+ activeAnnotation: Annotation | null;
69
+ annotations: AnnotationCollection;
70
+ }): Array<Annotation>;
71
+ }
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module comments/annotations/inlineannotations
11
+ * @publicApi
12
+ */
13
+ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
14
+ import AnnotationsUIs, { type AnnotationsUI } from './annotationsuis.js';
15
+ import EditorAnnotations from './editorannotations.js';
16
+ import { ContextualBalloon } from 'ckeditor5/src/ui.js';
17
+ import './../../theme/annotation-inline.css';
18
+ import type Annotation from './annotation.js';
19
+ import type AnnotationCollection from './annotationcollection.js';
20
+ /**
21
+ * The popup-style UI for displaying annotations next to editor target elements.
22
+ *
23
+ * It displays {@link module:comments/annotations/annotation~Annotation annotations} in the
24
+ * {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon balloon} where the current
25
+ * {@link module:comments/annotations/inlineannotations~InlineAnnotations#activeAnnotation} is the displayed one.
26
+ *
27
+ * Note: this UI type works only with {@link module:core/editor/editor~Editor the Editor} and cannot be used in integrations where
28
+ * there is only {@link module:core/context~Context context} without any editor.
29
+ *
30
+ * This UI is intended for narrow screens.
31
+ *
32
+ * To activate this UI use one of the following:
33
+ *
34
+ * ```ts
35
+ * editor.plugins.get( 'AnnotationsUIs' ).switchTo( 'inline' );
36
+ * editor.plugins.get( 'AnnotationsUIs' ).activate( 'inline', filter );
37
+ * ```
38
+ *
39
+ * See {@link module:comments/annotations/annotationsuis~AnnotationsUIs}.
40
+ */
41
+ export default class InlineAnnotations extends Plugin implements AnnotationsUI<Plugin> {
42
+ /**
43
+ * An active annotation tracked by this UI.
44
+ *
45
+ * @observable
46
+ */
47
+ activeAnnotation: Annotation | null;
48
+ isAttached: boolean;
49
+ /**
50
+ * A collection of annotations controlled by this UI.
51
+ *
52
+ * This property is readonly and should not be operated on directly. Use it only to read which annotations are added to this UI.
53
+ *
54
+ * It is set to `null` if `InlineAnnotations` is not
55
+ * {@link module:comments/annotations/inlineannotations~InlineAnnotations#attach attached}.
56
+ */
57
+ annotations: AnnotationCollection | null;
58
+ /**
59
+ * @inheritDoc
60
+ */
61
+ static get requires(): readonly [typeof EditorAnnotations, typeof ContextualBalloon, typeof AnnotationsUIs];
62
+ /**
63
+ * @inheritDoc
64
+ */
65
+ static get pluginName(): "InlineAnnotations";
66
+ /**
67
+ * @inheritDoc
68
+ */
69
+ constructor(editor: Editor);
70
+ /**
71
+ * @inheritDoc
72
+ */
73
+ init(): void;
74
+ /**
75
+ * @inheritDoc
76
+ */
77
+ afterInit(): void;
78
+ /**
79
+ * Sets the active annotation for this UI.
80
+ */
81
+ setActiveAnnotation(annotation: Annotation | null): void;
82
+ /**
83
+ * @inheritDoc
84
+ */
85
+ attach(annotations: AnnotationCollection): void;
86
+ /**
87
+ * @inheritDoc
88
+ */
89
+ detach(): void;
90
+ /**
91
+ * @inheritDoc
92
+ */
93
+ destroy(): void;
94
+ }
@@ -0,0 +1,89 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module comments/annotations/narrowsidebar
11
+ * @publicApi
12
+ */
13
+ import { ContextPlugin, Context, type Editor } from 'ckeditor5/src/core.js';
14
+ import AnnotationsUIs, { type AnnotationsUI } from './annotationsuis.js';
15
+ import Sidebar from './sidebar.js';
16
+ import { BalloonPanelView, BodyCollection } from 'ckeditor5/src/ui.js';
17
+ import '../../theme/sidebar-narrow.css';
18
+ import type Annotation from './annotation.js';
19
+ import type { default as AnnotationCollection } from './annotationcollection.js';
20
+ /**
21
+ * The narrow sidebar UI for displaying annotations.
22
+ *
23
+ * Binds {@link module:comments/annotations/annotations~Annotations} plugin with
24
+ * {@link module:comments/annotations/sidebar~Sidebar} plugin to display annotations in the sidebar as
25
+ * {@link module:comments/annotations/view/annotationcounterbuttonview~AnnotationCounterButtonView small icons}.
26
+ *
27
+ * After selecting an annotation the {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView} with an
28
+ * {@link module:comments/annotations/view/annotationview~AnnotationView} appears attached to the sidebar item.
29
+ *
30
+ * This UI is intended for medium-sized viewports.
31
+ *
32
+ * To activate this UI use one of the following:
33
+ *
34
+ * ```ts
35
+ * editor.plugins.get( 'AnnotationsUIs' ).switchTo( 'narrowSidebar' );
36
+ * editor.plugins.get( 'AnnotationsUIs' ).activate( 'narrowSidebar', filter );
37
+ * ```
38
+ *
39
+ * See {@link module:comments/annotations/annotationsuis~AnnotationsUIs}.
40
+ */
41
+ export default class NarrowSidebar extends ContextPlugin implements AnnotationsUI<ContextPlugin> {
42
+ /**
43
+ * An active annotation tracked by this UI.
44
+ */
45
+ activeAnnotation: Annotation | null;
46
+ bodyCollection: BodyCollection;
47
+ balloonPanelView: BalloonPanelView;
48
+ isAttached: boolean;
49
+ /**
50
+ * A collection of annotations controlled by this UI.
51
+ *
52
+ * This property is readonly and should not be operated on directly. Use it only to read which annotations are added to this UI.
53
+ *
54
+ * It is set to `null` if `NarrowSidebar` is not {@link module:comments/annotations/narrowsidebar~NarrowSidebar#attach attached}.
55
+ */
56
+ annotations: AnnotationCollection | null;
57
+ /**
58
+ * @inheritDoc
59
+ */
60
+ static get requires(): readonly [typeof Sidebar, typeof AnnotationsUIs];
61
+ /**
62
+ * @inheritDoc
63
+ */
64
+ static get pluginName(): "NarrowSidebar";
65
+ /**
66
+ * @inheritDoc
67
+ */
68
+ constructor(context: Context | Editor);
69
+ /**
70
+ * @inheritDoc
71
+ */
72
+ init(): void;
73
+ /**
74
+ * @inheritDoc
75
+ */
76
+ attach(annotations: AnnotationCollection): void;
77
+ /**
78
+ * Sets the active annotation for this UI.
79
+ */
80
+ setActiveAnnotation(annotation: Annotation | null): void;
81
+ /**
82
+ * @inheritDoc
83
+ */
84
+ detach(): void;
85
+ /**
86
+ * @inheritDoc
87
+ */
88
+ destroy(): void;
89
+ }
@@ -0,0 +1,104 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module comments/annotations/sidebar
11
+ * @publicApi
12
+ */
13
+ import { ContextPlugin, type Context, type Editor } from 'ckeditor5/src/core.js';
14
+ import type { View } from 'ckeditor5/src/ui.js';
15
+ import SidebarView from './view/sidebarview.js';
16
+ import SidebarItemView from './view/sidebaritemview.js';
17
+ import type Annotation from './annotation.js';
18
+ /**
19
+ * Displays {@link module:comments/annotations/annotationcollection~AnnotationCollection annotations} inside a sidebar.
20
+ *
21
+ * `Sidebar` provides a {@link module:comments/annotations/view/sidebarview~SidebarView} which can be injected at any place on a website.
22
+ *
23
+ * It's main role is to display and correctly position annotation views added to the sidebar, accordingly to their target elements
24
+ * or `Rect`s.
25
+ *
26
+ * The following plugins use `Sidebar` to provide annotations UI:
27
+ *
28
+ * * {@link module:comments/annotations/widesidebar~WideSidebar}
29
+ * * {@link module:comments/annotations/narrowsidebar~NarrowSidebar}
30
+ *
31
+ * The sidebar plugin introduces {@link module:comments/annotations/view/sidebaritemview~SidebarItemView} which is a wrapper view for
32
+ * {@link module:comments/annotations/view/annotationview~AnnotationView}. It adds an interface needed for positioning views inside
33
+ * the sidebar.
34
+ *
35
+ * Structure of items:
36
+ *
37
+ * |-> SidebarItemView -> AnnotationView -> added View
38
+ * Sidebar#view#list -|-> SidebarItemView -> AnnotationView -> added View
39
+ * |-> ...
40
+ */
41
+ export default class Sidebar extends ContextPlugin {
42
+ /**
43
+ * Container element into which sidebar is injected (in the DOM).
44
+ *
45
+ * @observable
46
+ */
47
+ container: HTMLElement | null;
48
+ /**
49
+ * Sidebar view.
50
+ */
51
+ view: SidebarView;
52
+ /**
53
+ * @inheritDoc
54
+ */
55
+ static get pluginName(): "Sidebar";
56
+ /**
57
+ * @inheritDoc
58
+ */
59
+ constructor(context: Context | Editor);
60
+ /**
61
+ * @inheritDoc
62
+ */
63
+ init(): void;
64
+ /**
65
+ * Sets a new sidebar container.
66
+ */
67
+ setContainer(container: HTMLElement): void;
68
+ /**
69
+ * Rearranges annotations when the annotation is removed.
70
+ */
71
+ rearrange({ removedAnnotation, previousAnnotation, nextAnnotation }: {
72
+ removedAnnotation: Annotation;
73
+ previousAnnotation: Annotation | null;
74
+ nextAnnotation: Annotation | null;
75
+ }): void;
76
+ /**
77
+ * Refreshes sidebar items when one of the annotations is activated.
78
+ *
79
+ * @param options.activatedAnnotation The activated annotation.
80
+ * @param options.blurredAnnotation The previously active annotation.
81
+ * @param options.disableAnimationOnActivatedAnnotation Disables animation on the activated annotation.
82
+ */
83
+ refresh({ blurredAnnotation, activatedAnnotation, disableAnimationOnActivatedAnnotation }: {
84
+ blurredAnnotation: Annotation | null;
85
+ activatedAnnotation: Annotation | null;
86
+ disableAnimationOnActivatedAnnotation?: boolean;
87
+ }): void;
88
+ /**
89
+ * Creates new {@link module:comments/annotations/view/sidebaritemview~SidebarItemView} and binds its
90
+ * position with {@link module:comments/annotations/view/annotationview~AnnotationView} target position.
91
+ *
92
+ * By default, annotation's view will be displayed in the sidebar. However, you can provide any other view
93
+ * to be displayed instead using `annotationToDisplay`. `annotation` will be then used only to gather data needed by `Sidebar`.
94
+ */
95
+ addAnnotation(annotation: Annotation, viewToDisplay?: View): SidebarItemView;
96
+ /**
97
+ * Returns sidebar item view that wraps given annotation view.
98
+ */
99
+ getSidebarItemView(annotation: Annotation): SidebarItemView | undefined;
100
+ /**
101
+ * @inheritDoc
102
+ */
103
+ destroy(): void;
104
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module comments/annotations/view/annotationcounterbuttonview
11
+ * @publicApi
12
+ */
13
+ import { ButtonView, View } from 'ckeditor5/src/ui.js';
14
+ import type { Locale } from 'ckeditor5/src/utils.js';
15
+ /**
16
+ * A view used in the sidebar by {@link module:comments/annotations/narrowsidebar~NarrowSidebar}.
17
+ */
18
+ export default class AnnotationCounterButtonView extends ButtonView {
19
+ /**
20
+ * @observable
21
+ */
22
+ isDirty: boolean;
23
+ /**
24
+ * @observable
25
+ */
26
+ number: number;
27
+ /**
28
+ * @observable
29
+ */
30
+ annotationType: string;
31
+ counterView: View;
32
+ constructor(locale: Locale);
33
+ }
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module comments/annotations/view/annotationview
11
+ * @publicApi
12
+ */
13
+ import { View, type ViewCollection } from 'ckeditor5/src/ui.js';
14
+ import { FocusTracker, KeystrokeHandler, type Rect, type Locale } from 'ckeditor5/src/utils.js';
15
+ import '../../../theme/annotation.css';
16
+ /**
17
+ * A wrapping view for any view added to the `Annotations` plugin.
18
+ *
19
+ * It introduces functionalities that make the given view ready to be used as an annotation, such as focus tracking, height resizing,
20
+ * and other observable properties that help share current annotation state across different UIs.
21
+ */
22
+ export default class AnnotationView extends View {
23
+ /**
24
+ * Tracks focus on the annotation view.
25
+ *
26
+ * Add a DOM element to this focus tracker to prevent blurring annotation view
27
+ * when the DOM element is focused.
28
+ */
29
+ readonly focusTracker: FocusTracker;
30
+ readonly id: string;
31
+ readonly keystrokes: KeystrokeHandler;
32
+ /**
33
+ * Target rectangle to which the annotation should be attached.
34
+ *
35
+ * @observable
36
+ */
37
+ targetRect: Rect | null;
38
+ /**
39
+ * Annotation view height.
40
+ *
41
+ * @observable
42
+ */
43
+ height: number;
44
+ /**
45
+ * Informs if an annotation is active.
46
+ *
47
+ * @observable
48
+ */
49
+ isActive: boolean;
50
+ /**
51
+ * Informs if there are unsaved changes in the annotation.
52
+ *
53
+ * @observable
54
+ */
55
+ isDirty: boolean;
56
+ /**
57
+ * The number of items in the annotation.
58
+ *
59
+ * @observable
60
+ */
61
+ length: number;
62
+ /**
63
+ * @observable
64
+ */
65
+ type: string;
66
+ element: HTMLElement;
67
+ /**
68
+ * Collection for content views.
69
+ */
70
+ content: ViewCollection;
71
+ /**
72
+ * The inner annotation view.
73
+ */
74
+ mainView: AnnotationMainView;
75
+ /**
76
+ * @inheritDoc
77
+ */
78
+ constructor(locale: Locale, mainView: AnnotationMainView);
79
+ /**
80
+ * @inheritDoc
81
+ */
82
+ render(): void;
83
+ /**
84
+ * @inheritDoc
85
+ */
86
+ destroy(): void;
87
+ /**
88
+ * Focuses the annotation view.
89
+ */
90
+ focus(): void;
91
+ }
92
+ export interface AnnotationMainView extends View {
93
+ isActive: boolean;
94
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module comments/annotations/view/sidebaritemview
11
+ * @publicApi
12
+ */
13
+ import { View, type ViewCollection } from 'ckeditor5/src/ui.js';
14
+ import { type Locale } from 'ckeditor5/src/utils.js';
15
+ /**
16
+ * A wrapper view that wraps given {@link module:ui/view~View} to display it as a {@link module:comments/annotations/sidebar~Sidebar} item.
17
+ */
18
+ export default class SidebarItemView extends View {
19
+ element: HTMLElement;
20
+ /**
21
+ * The item top offset.
22
+ * Setting `0` as the initial value makes new items falling from heaven.
23
+ *
24
+ * @observable
25
+ */
26
+ top: number;
27
+ /**
28
+ * @observable
29
+ */
30
+ bottom: number;
31
+ /**
32
+ * @observable
33
+ */
34
+ height: number;
35
+ /**
36
+ * @observable
37
+ */
38
+ isAnimationDisabled: boolean;
39
+ /**
40
+ * A collection of content views.
41
+ */
42
+ content: ViewCollection;
43
+ /**
44
+ * @inheritDoc
45
+ */
46
+ constructor(locale: Locale);
47
+ /**
48
+ * @inheritDoc
49
+ */
50
+ render(): void;
51
+ /**
52
+ * Updates {@link #height the height property} according to the element's DOM height.
53
+ */
54
+ updateHeight(): void;
55
+ /**
56
+ * @inheritDoc
57
+ */
58
+ destroy(): void;
59
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module comments/annotations/view/sidebarview
11
+ * @publicApi
12
+ */
13
+ import { View, type ViewCollection } from 'ckeditor5/src/ui.js';
14
+ import { type Locale } from 'ckeditor5/src/utils.js';
15
+ import '../../../theme/sidebar.css';
16
+ /**
17
+ * The sidebar view class that displays the collection of sidebar item views.
18
+ */
19
+ export default class SidebarView extends View {
20
+ /**
21
+ * @observable
22
+ */
23
+ minHeight: number | null;
24
+ /**
25
+ * @observable
26
+ */
27
+ class: string;
28
+ /**
29
+ * A collection of sidebar item views.
30
+ */
31
+ list: ViewCollection;
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ constructor(locale: Locale);
36
+ }
@@ -0,0 +1,81 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
7
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
8
+ */
9
+ /**
10
+ * @module comments/annotations/widesidebar
11
+ * @publicApi
12
+ */
13
+ import { ContextPlugin, Context, type Editor } from 'ckeditor5/src/core.js';
14
+ import AnnotationsUIs, { type AnnotationsUI } from './annotationsuis.js';
15
+ import Sidebar from './sidebar.js';
16
+ import type Annotation from './annotation.js';
17
+ import type { default as AnnotationCollection } from './annotationcollection.js';
18
+ /**
19
+ * The wide sidebar UI for displaying annotations.
20
+ *
21
+ * In this implementation {@link module:comments/annotations/sidebar~Sidebar the sidebar} displays full
22
+ * {@link module:comments/annotations/view/annotationview~AnnotationView annotation views}.
23
+ *
24
+ * To activate this UI use one of the following:
25
+ *
26
+ * ```ts
27
+ * editor.plugins.get( 'AnnotationsUIs' ).switchTo( 'wideSidebar' );
28
+ * editor.plugins.get( 'AnnotationsUIs' ).activate( 'wideSidebar', filter );
29
+ * ```
30
+ *
31
+ * See {@link module:comments/annotations/annotationsuis~AnnotationsUIs}.
32
+ */
33
+ export default class WideSidebar extends ContextPlugin implements AnnotationsUI<ContextPlugin> {
34
+ /**
35
+ * An active annotation tracked by this UI.
36
+ *
37
+ * @observable
38
+ */
39
+ activeAnnotation: Annotation | null;
40
+ isAttached: boolean;
41
+ /**
42
+ * A collection of annotations controlled by this UI.
43
+ *
44
+ * This property is readonly and should not be operated on directly. Use it only to read which annotations are added to this UI.
45
+ *
46
+ * It is set to `null` if `WideSidebar` is not {@link module:comments/annotations/widesidebar~WideSidebar#attach attached}.
47
+ */
48
+ annotations: AnnotationCollection | null;
49
+ /**
50
+ * @inheritDoc
51
+ */
52
+ static get requires(): readonly [typeof Sidebar, typeof AnnotationsUIs];
53
+ /**
54
+ * @inheritDoc
55
+ */
56
+ static get pluginName(): "WideSidebar";
57
+ /**
58
+ * @inheritDoc
59
+ */
60
+ constructor(context: Context | Editor);
61
+ /**
62
+ * @inheritDoc
63
+ */
64
+ init(): void;
65
+ /**
66
+ * Sets the active annotation for this UI.
67
+ */
68
+ setActiveAnnotation(annotation: Annotation | null): void;
69
+ /**
70
+ * @inheritDoc
71
+ */
72
+ attach(annotations: AnnotationCollection): void;
73
+ /**
74
+ * @inheritDoc
75
+ */
76
+ detach(): void;
77
+ /**
78
+ * @inheritDoc
79
+ */
80
+ destroy(): void;
81
+ }