@ckeditor/ckeditor5-document-outline 0.0.0-internal-20241017.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 (277) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE.md +22 -0
  3. package/README.md +44 -0
  4. package/build/document-outline.js +5 -0
  5. package/build/translations/ar.js +1 -0
  6. package/build/translations/bg.js +1 -0
  7. package/build/translations/bn.js +1 -0
  8. package/build/translations/ca.js +1 -0
  9. package/build/translations/cs.js +1 -0
  10. package/build/translations/da.js +1 -0
  11. package/build/translations/de.js +1 -0
  12. package/build/translations/el.js +1 -0
  13. package/build/translations/en-au.js +1 -0
  14. package/build/translations/es.js +1 -0
  15. package/build/translations/et.js +1 -0
  16. package/build/translations/fi.js +1 -0
  17. package/build/translations/fr.js +1 -0
  18. package/build/translations/gl.js +1 -0
  19. package/build/translations/he.js +1 -0
  20. package/build/translations/hi.js +1 -0
  21. package/build/translations/hr.js +1 -0
  22. package/build/translations/hu.js +1 -0
  23. package/build/translations/id.js +1 -0
  24. package/build/translations/it.js +1 -0
  25. package/build/translations/ja.js +1 -0
  26. package/build/translations/ko.js +1 -0
  27. package/build/translations/lt.js +1 -0
  28. package/build/translations/lv.js +1 -0
  29. package/build/translations/ms.js +1 -0
  30. package/build/translations/nl.js +1 -0
  31. package/build/translations/no.js +1 -0
  32. package/build/translations/pl.js +1 -0
  33. package/build/translations/pt-br.js +1 -0
  34. package/build/translations/pt.js +1 -0
  35. package/build/translations/ro.js +1 -0
  36. package/build/translations/ru.js +1 -0
  37. package/build/translations/sk.js +1 -0
  38. package/build/translations/sr-latn.js +1 -0
  39. package/build/translations/sr.js +1 -0
  40. package/build/translations/sv.js +1 -0
  41. package/build/translations/th.js +1 -0
  42. package/build/translations/tr.js +1 -0
  43. package/build/translations/ug.js +1 -0
  44. package/build/translations/uk.js +1 -0
  45. package/build/translations/vi.js +1 -0
  46. package/build/translations/zh-cn.js +1 -0
  47. package/build/translations/zh.js +1 -0
  48. package/ckeditor5-metadata.json +45 -0
  49. package/dist/augmentation.d.ts +31 -0
  50. package/dist/documentoutline/documentoutlineui.d.ts +52 -0
  51. package/dist/documentoutline/documentoutlineutils.d.ts +78 -0
  52. package/dist/documentoutline/ui/documentoutlineitemview.d.ts +55 -0
  53. package/dist/documentoutline/ui/documentoutlineview.d.ts +56 -0
  54. package/dist/documentoutline/utils.d.ts +21 -0
  55. package/dist/documentoutline.d.ts +103 -0
  56. package/dist/index-content.css +44 -0
  57. package/dist/index-editor.css +147 -0
  58. package/dist/index.css +206 -0
  59. package/dist/index.d.ts +20 -0
  60. package/dist/index.js +23 -0
  61. package/dist/legacyerrors.d.ts +36 -0
  62. package/dist/tableofcontents/headingid.d.ts +30 -0
  63. package/dist/tableofcontents/tableofcontentscommand.d.ts +25 -0
  64. package/dist/tableofcontents/tableofcontentsediting.d.ts +49 -0
  65. package/dist/tableofcontents/tableofcontentsui.d.ts +31 -0
  66. package/dist/tableofcontents.d.ts +38 -0
  67. package/dist/translations/ar.d.ts +8 -0
  68. package/dist/translations/ar.js +23 -0
  69. package/dist/translations/ar.umd.js +23 -0
  70. package/dist/translations/bg.d.ts +8 -0
  71. package/dist/translations/bg.js +23 -0
  72. package/dist/translations/bg.umd.js +23 -0
  73. package/dist/translations/bn.d.ts +8 -0
  74. package/dist/translations/bn.js +23 -0
  75. package/dist/translations/bn.umd.js +23 -0
  76. package/dist/translations/ca.d.ts +8 -0
  77. package/dist/translations/ca.js +23 -0
  78. package/dist/translations/ca.umd.js +23 -0
  79. package/dist/translations/cs.d.ts +8 -0
  80. package/dist/translations/cs.js +23 -0
  81. package/dist/translations/cs.umd.js +23 -0
  82. package/dist/translations/da.d.ts +8 -0
  83. package/dist/translations/da.js +23 -0
  84. package/dist/translations/da.umd.js +23 -0
  85. package/dist/translations/de.d.ts +8 -0
  86. package/dist/translations/de.js +23 -0
  87. package/dist/translations/de.umd.js +23 -0
  88. package/dist/translations/el.d.ts +8 -0
  89. package/dist/translations/el.js +23 -0
  90. package/dist/translations/el.umd.js +23 -0
  91. package/dist/translations/en-au.d.ts +8 -0
  92. package/dist/translations/en-au.js +23 -0
  93. package/dist/translations/en-au.umd.js +23 -0
  94. package/dist/translations/en.d.ts +8 -0
  95. package/dist/translations/en.js +23 -0
  96. package/dist/translations/en.umd.js +23 -0
  97. package/dist/translations/es.d.ts +8 -0
  98. package/dist/translations/es.js +23 -0
  99. package/dist/translations/es.umd.js +23 -0
  100. package/dist/translations/et.d.ts +8 -0
  101. package/dist/translations/et.js +23 -0
  102. package/dist/translations/et.umd.js +23 -0
  103. package/dist/translations/fi.d.ts +8 -0
  104. package/dist/translations/fi.js +23 -0
  105. package/dist/translations/fi.umd.js +23 -0
  106. package/dist/translations/fr.d.ts +8 -0
  107. package/dist/translations/fr.js +23 -0
  108. package/dist/translations/fr.umd.js +23 -0
  109. package/dist/translations/gl.d.ts +8 -0
  110. package/dist/translations/gl.js +23 -0
  111. package/dist/translations/gl.umd.js +23 -0
  112. package/dist/translations/he.d.ts +8 -0
  113. package/dist/translations/he.js +23 -0
  114. package/dist/translations/he.umd.js +23 -0
  115. package/dist/translations/hi.d.ts +8 -0
  116. package/dist/translations/hi.js +23 -0
  117. package/dist/translations/hi.umd.js +23 -0
  118. package/dist/translations/hr.d.ts +8 -0
  119. package/dist/translations/hr.js +23 -0
  120. package/dist/translations/hr.umd.js +23 -0
  121. package/dist/translations/hu.d.ts +8 -0
  122. package/dist/translations/hu.js +23 -0
  123. package/dist/translations/hu.umd.js +23 -0
  124. package/dist/translations/id.d.ts +8 -0
  125. package/dist/translations/id.js +23 -0
  126. package/dist/translations/id.umd.js +23 -0
  127. package/dist/translations/it.d.ts +8 -0
  128. package/dist/translations/it.js +23 -0
  129. package/dist/translations/it.umd.js +23 -0
  130. package/dist/translations/ja.d.ts +8 -0
  131. package/dist/translations/ja.js +23 -0
  132. package/dist/translations/ja.umd.js +23 -0
  133. package/dist/translations/ko.d.ts +8 -0
  134. package/dist/translations/ko.js +23 -0
  135. package/dist/translations/ko.umd.js +23 -0
  136. package/dist/translations/lt.d.ts +8 -0
  137. package/dist/translations/lt.js +23 -0
  138. package/dist/translations/lt.umd.js +23 -0
  139. package/dist/translations/lv.d.ts +8 -0
  140. package/dist/translations/lv.js +23 -0
  141. package/dist/translations/lv.umd.js +23 -0
  142. package/dist/translations/ms.d.ts +8 -0
  143. package/dist/translations/ms.js +23 -0
  144. package/dist/translations/ms.umd.js +23 -0
  145. package/dist/translations/nl.d.ts +8 -0
  146. package/dist/translations/nl.js +23 -0
  147. package/dist/translations/nl.umd.js +23 -0
  148. package/dist/translations/no.d.ts +8 -0
  149. package/dist/translations/no.js +23 -0
  150. package/dist/translations/no.umd.js +23 -0
  151. package/dist/translations/pl.d.ts +8 -0
  152. package/dist/translations/pl.js +23 -0
  153. package/dist/translations/pl.umd.js +23 -0
  154. package/dist/translations/pt-br.d.ts +8 -0
  155. package/dist/translations/pt-br.js +23 -0
  156. package/dist/translations/pt-br.umd.js +23 -0
  157. package/dist/translations/pt.d.ts +8 -0
  158. package/dist/translations/pt.js +23 -0
  159. package/dist/translations/pt.umd.js +23 -0
  160. package/dist/translations/ro.d.ts +8 -0
  161. package/dist/translations/ro.js +23 -0
  162. package/dist/translations/ro.umd.js +23 -0
  163. package/dist/translations/ru.d.ts +8 -0
  164. package/dist/translations/ru.js +23 -0
  165. package/dist/translations/ru.umd.js +23 -0
  166. package/dist/translations/sk.d.ts +8 -0
  167. package/dist/translations/sk.js +23 -0
  168. package/dist/translations/sk.umd.js +23 -0
  169. package/dist/translations/sr-latn.d.ts +8 -0
  170. package/dist/translations/sr-latn.js +23 -0
  171. package/dist/translations/sr-latn.umd.js +23 -0
  172. package/dist/translations/sr.d.ts +8 -0
  173. package/dist/translations/sr.js +23 -0
  174. package/dist/translations/sr.umd.js +23 -0
  175. package/dist/translations/sv.d.ts +8 -0
  176. package/dist/translations/sv.js +23 -0
  177. package/dist/translations/sv.umd.js +23 -0
  178. package/dist/translations/th.d.ts +8 -0
  179. package/dist/translations/th.js +23 -0
  180. package/dist/translations/th.umd.js +23 -0
  181. package/dist/translations/tr.d.ts +8 -0
  182. package/dist/translations/tr.js +23 -0
  183. package/dist/translations/tr.umd.js +23 -0
  184. package/dist/translations/ug.d.ts +8 -0
  185. package/dist/translations/ug.js +23 -0
  186. package/dist/translations/ug.umd.js +23 -0
  187. package/dist/translations/uk.d.ts +8 -0
  188. package/dist/translations/uk.js +23 -0
  189. package/dist/translations/uk.umd.js +23 -0
  190. package/dist/translations/vi.d.ts +8 -0
  191. package/dist/translations/vi.js +23 -0
  192. package/dist/translations/vi.umd.js +23 -0
  193. package/dist/translations/zh-cn.d.ts +8 -0
  194. package/dist/translations/zh-cn.js +23 -0
  195. package/dist/translations/zh-cn.umd.js +23 -0
  196. package/dist/translations/zh.d.ts +8 -0
  197. package/dist/translations/zh.js +23 -0
  198. package/dist/translations/zh.umd.js +23 -0
  199. package/dist/utils/common-translations.d.ts +13 -0
  200. package/lang/contexts.json +6 -0
  201. package/lang/translations/ar.po +34 -0
  202. package/lang/translations/bg.po +34 -0
  203. package/lang/translations/bn.po +34 -0
  204. package/lang/translations/ca.po +34 -0
  205. package/lang/translations/cs.po +34 -0
  206. package/lang/translations/da.po +34 -0
  207. package/lang/translations/de.po +34 -0
  208. package/lang/translations/el.po +34 -0
  209. package/lang/translations/en-au.po +34 -0
  210. package/lang/translations/en.po +34 -0
  211. package/lang/translations/es.po +34 -0
  212. package/lang/translations/et.po +34 -0
  213. package/lang/translations/fi.po +34 -0
  214. package/lang/translations/fr.po +34 -0
  215. package/lang/translations/gl.po +34 -0
  216. package/lang/translations/he.po +34 -0
  217. package/lang/translations/hi.po +34 -0
  218. package/lang/translations/hr.po +34 -0
  219. package/lang/translations/hu.po +34 -0
  220. package/lang/translations/id.po +34 -0
  221. package/lang/translations/it.po +34 -0
  222. package/lang/translations/ja.po +34 -0
  223. package/lang/translations/ko.po +34 -0
  224. package/lang/translations/lt.po +34 -0
  225. package/lang/translations/lv.po +34 -0
  226. package/lang/translations/ms.po +34 -0
  227. package/lang/translations/nl.po +34 -0
  228. package/lang/translations/no.po +34 -0
  229. package/lang/translations/pl.po +34 -0
  230. package/lang/translations/pt-br.po +34 -0
  231. package/lang/translations/pt.po +34 -0
  232. package/lang/translations/ro.po +34 -0
  233. package/lang/translations/ru.po +34 -0
  234. package/lang/translations/sk.po +34 -0
  235. package/lang/translations/sr-latn.po +34 -0
  236. package/lang/translations/sr.po +34 -0
  237. package/lang/translations/sv.po +34 -0
  238. package/lang/translations/th.po +34 -0
  239. package/lang/translations/tr.po +34 -0
  240. package/lang/translations/ug.po +34 -0
  241. package/lang/translations/uk.po +34 -0
  242. package/lang/translations/vi.po +34 -0
  243. package/lang/translations/zh-cn.po +34 -0
  244. package/lang/translations/zh.po +34 -0
  245. package/package.json +41 -0
  246. package/src/augmentation.d.ts +27 -0
  247. package/src/augmentation.js +23 -0
  248. package/src/documentoutline/documentoutlineui.d.ts +48 -0
  249. package/src/documentoutline/documentoutlineui.js +23 -0
  250. package/src/documentoutline/documentoutlineutils.d.ts +74 -0
  251. package/src/documentoutline/documentoutlineutils.js +23 -0
  252. package/src/documentoutline/ui/documentoutlineitemview.d.ts +51 -0
  253. package/src/documentoutline/ui/documentoutlineitemview.js +23 -0
  254. package/src/documentoutline/ui/documentoutlineview.d.ts +52 -0
  255. package/src/documentoutline/ui/documentoutlineview.js +23 -0
  256. package/src/documentoutline/utils.d.ts +17 -0
  257. package/src/documentoutline/utils.js +23 -0
  258. package/src/documentoutline.d.ts +99 -0
  259. package/src/documentoutline.js +23 -0
  260. package/src/index.d.ts +16 -0
  261. package/src/index.js +23 -0
  262. package/src/legacyerrors.d.ts +32 -0
  263. package/src/legacyerrors.js +23 -0
  264. package/src/tableofcontents/headingid.d.ts +26 -0
  265. package/src/tableofcontents/headingid.js +23 -0
  266. package/src/tableofcontents/tableofcontentscommand.d.ts +21 -0
  267. package/src/tableofcontents/tableofcontentscommand.js +23 -0
  268. package/src/tableofcontents/tableofcontentsediting.d.ts +45 -0
  269. package/src/tableofcontents/tableofcontentsediting.js +23 -0
  270. package/src/tableofcontents/tableofcontentsui.d.ts +27 -0
  271. package/src/tableofcontents/tableofcontentsui.js +23 -0
  272. package/src/tableofcontents.d.ts +34 -0
  273. package/src/tableofcontents.js +23 -0
  274. package/src/utils/common-translations.d.ts +9 -0
  275. package/src/utils/common-translations.js +23 -0
  276. package/theme/documentoutline.css +104 -0
  277. package/theme/tableofcontents.css +86 -0
@@ -0,0 +1,52 @@
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 document-outline/documentoutline/documentoutlineui
11
+ * @publicApi
12
+ */
13
+ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
14
+ import DocumentOutlineView from './ui/documentoutlineview.js';
15
+ import '../../theme/documentoutline.css';
16
+ /**
17
+ * Provides the UI for the document outline feature.
18
+ */
19
+ export default class DocumentOutlineUI extends Plugin {
20
+ /**
21
+ * The representation of the document outline view.
22
+ */
23
+ view: DocumentOutlineView;
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ static get pluginName(): "DocumentOutlineUI";
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ static get isOfficialPlugin(): true;
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ static get isPremiumPlugin(): true;
36
+ /**
37
+ * @inheritDoc
38
+ */
39
+ constructor(editor: Editor);
40
+ /**
41
+ * @inheritDoc
42
+ */
43
+ init(): void;
44
+ /**
45
+ * @inheritDoc
46
+ */
47
+ afterInit(): void;
48
+ /**
49
+ * @inheritDoc
50
+ */
51
+ destroy(): void;
52
+ }
@@ -0,0 +1,78 @@
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 document-outline/documentoutline/documentoutlineutils
11
+ */
12
+ import { Plugin } from 'ckeditor5/src/core.js';
13
+ import { type Element } from 'ckeditor5/src/engine.js';
14
+ import { diffToChanges } from 'ckeditor5/src/utils.js';
15
+ /**
16
+ * Document outline utilities.
17
+ */
18
+ export default class DocumentOutlineUtils extends Plugin {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get pluginName(): "DocumentOutlineUtils";
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get isOfficialPlugin(): true;
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ static get isPremiumPlugin(): true;
31
+ /**
32
+ * Starts listening for editor events and handles them on the model document `change` event. This means both
33
+ * changes to the structure of the document and changes to the selection are reflected in the outline.
34
+ */
35
+ init(): void;
36
+ /**
37
+ * @inheritDoc
38
+ */
39
+ afterInit(): void;
40
+ }
41
+ /**
42
+ * The definition of the item in the document outline.
43
+ */
44
+ export type OutlineItemDefinition = {
45
+ level: number;
46
+ text: string;
47
+ modelElement: Element;
48
+ };
49
+ /**
50
+ * Fired whenever the headings structure in the document changes.
51
+ *
52
+ * @eventName ~DocumentOutlineUtils#change
53
+ * @param outlineDefinitions The list of current outline definitions.
54
+ * @param outlineChanges Describes what changes were applied in the headings structure.
55
+ * @param activeItemIndex The index of the active document outline item.
56
+ */
57
+ export type OutlineChangeEvent = {
58
+ name: 'change';
59
+ args: [
60
+ {
61
+ outlineDefinitions: Array<OutlineItemDefinition>;
62
+ outlineChanges: ReturnType<typeof diffToChanges<OutlineItemDefinition>>;
63
+ activeItemIndex: number;
64
+ }
65
+ ];
66
+ };
67
+ /**
68
+ * Fired whenever the active document outline item is changed.
69
+ *
70
+ * @eventName ~DocumentOutlineUtils#activeItemIndex
71
+ * @param activeItemIndex The index of the active document outline item.
72
+ */
73
+ export type ActiveOutlineItemChangeEvent = {
74
+ name: 'activeItemIndex';
75
+ args: [{
76
+ index: number;
77
+ }];
78
+ };
@@ -0,0 +1,55 @@
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 document-outline/documentoutline/ui/documentoutlineitemview
11
+ */
12
+ import { View } from 'ckeditor5/src/ui.js';
13
+ import { type Locale } from 'ckeditor5/src/utils.js';
14
+ /**
15
+ * An item of the document outline.
16
+ */
17
+ export default class DocumentOutlineItemView extends View {
18
+ /**
19
+ * The textual content of the item.
20
+ *
21
+ * @observable
22
+ */
23
+ text: string;
24
+ /**
25
+ * The level of heading nesting in the document.
26
+ *
27
+ * @observable
28
+ */
29
+ level: number;
30
+ /**
31
+ * Indicates whether the given item is currently active.
32
+ *
33
+ * @observable
34
+ */
35
+ isActive: boolean;
36
+ /**
37
+ * Indicates whether the heading doesn't have any text.
38
+ *
39
+ * @observable
40
+ */
41
+ isEmpty: boolean;
42
+ /**
43
+ * @inheritDoc
44
+ */
45
+ constructor(locale: Locale, showEmptyHeadingText?: boolean);
46
+ }
47
+ /**
48
+ * Fired whenever an item in the document outline is clicked.
49
+ *
50
+ * @eventName ~DocumentOutlineItemView#click
51
+ */
52
+ export type DocumentOutlineItemViewClickEvent = {
53
+ name: 'click';
54
+ args: [];
55
+ };
@@ -0,0 +1,56 @@
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 document-outline/documentoutline/ui/documentoutlineview
11
+ */
12
+ import { View, type ViewCollection } from 'ckeditor5/src/ui.js';
13
+ import { type Locale, type diffToChanges } from 'ckeditor5/src/utils.js';
14
+ import type { OutlineItemDefinition } from '../documentoutlineutils.js';
15
+ import DocumentOutlineItemView from './documentoutlineitemview.js';
16
+ /**
17
+ * The document outline panel.
18
+ */
19
+ export default class DocumentOutlineView extends View {
20
+ /**
21
+ * A collection of document outline items.
22
+ */
23
+ readonly items: ViewCollection<DocumentOutlineItemView>;
24
+ /**
25
+ * Indicates which item is active at the moment.
26
+ *
27
+ * @observable
28
+ */
29
+ activeItemIndex: number;
30
+ /**
31
+ * Creates an instance of the {@link module:documentoutline/ui/documentoutlineview~DocumentOutlineView} class.
32
+ *
33
+ * @param locale The localization services instance.
34
+ * @param showEmptyHeadingText Indicates whether the display of a placeholder for empty heading is enabled in the editor.
35
+ * @param containerElement The element that contains the document outline.
36
+ */
37
+ constructor(locale: Locale, showEmptyHeadingText?: boolean, containerElement?: HTMLElement);
38
+ /**
39
+ * If a heading was added or deleted in the editor, insert or delete it in the document outline.
40
+ */
41
+ sync(changesInItems: ReturnType<typeof diffToChanges<OutlineItemDefinition>>): void;
42
+ /**
43
+ * @inheritDoc
44
+ */
45
+ destroy(): void;
46
+ }
47
+ /**
48
+ * Fired whenever an item in the document outline is clicked.
49
+ *
50
+ * @eventName ~DocumentOutlineView#itemSelected
51
+ * @param itemIndex Index of selected item.
52
+ */
53
+ export type DocumentOutlineViewItemSelectedEvent = {
54
+ name: 'itemSelected';
55
+ args: [itemIndex: number];
56
+ };
@@ -0,0 +1,21 @@
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 document-outline/documentoutline/utils
11
+ */
12
+ import { type Element } from 'ckeditor5/src/engine.js';
13
+ import { type Editor } from 'ckeditor5/src/core.js';
14
+ /**
15
+ * Returns all text contents that are inside the given element and all its children.
16
+ */
17
+ export declare function getElementText(element: Element): string;
18
+ /**
19
+ * Returns a list of standard headings or GHS headings configured in the editor.
20
+ */
21
+ export declare function getDefaultFeatureHeadingNames(editor: Editor): Array<string>;
@@ -0,0 +1,103 @@
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 document-outline/documentoutline
11
+ * @publicApi
12
+ */
13
+ import { Plugin } from 'ckeditor5/src/core.js';
14
+ import DocumentOutlineUtils from './documentoutline/documentoutlineutils.js';
15
+ import DocumentOutlineUI from './documentoutline/documentoutlineui.js';
16
+ /**
17
+ * The document outline feature.
18
+ * It allows for an easy access to a predefined list of headings in the document.
19
+ */
20
+ export default class DocumentOutline extends Plugin {
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ static get requires(): readonly [typeof DocumentOutlineUtils, typeof DocumentOutlineUI];
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ static get pluginName(): "DocumentOutline";
29
+ /**
30
+ * @inheritDoc
31
+ */
32
+ static get isOfficialPlugin(): true;
33
+ /**
34
+ * @inheritDoc
35
+ */
36
+ static get isPremiumPlugin(): true;
37
+ init(): void;
38
+ /**
39
+ * @inheritDoc
40
+ */
41
+ destroy(): void;
42
+ }
43
+ /**
44
+ * The configuration of the {@link module:document-outline/documentoutline~DocumentOutline document outline feature}.
45
+ *
46
+ * ```ts
47
+ * ClassicEditor
48
+ * .create( editorElement, {
49
+ * documentOutline: ... // Document outline feature configuration.
50
+ * } )
51
+ * .then( /* ... *\/ )
52
+ * .catch( /* ... *\/ );
53
+ * ```
54
+ *
55
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
56
+ */
57
+ export interface DocumentOutlineConfig {
58
+ /**
59
+ * The container element for the document outline to render. This should be a reference to an existing
60
+ * container element in the DOM.
61
+ */
62
+ container?: HTMLElement;
63
+ /**
64
+ * An array of {@glink framework/architecture/editing-engine#model model} element names considered
65
+ * as headings in the document outline.
66
+ *
67
+ * The index of the heading in the array reflects the heading nesting level. It can be used e.g. for reducing
68
+ * the number of visible headings.
69
+ *
70
+ * ```ts
71
+ * ClassicEditor
72
+ * .create( editorElement, {
73
+ * plugins: [ DocumentOutline, /* ... *\/ ],
74
+ * documentOutline: {
75
+ * headings: [ 'heading1', 'heading2', /* ... *\/ ],
76
+ * // ...
77
+ * }
78
+ * } )
79
+ * .then( /* ... *\/ )
80
+ * .catch( /* ... *\/ );
81
+ * ```
82
+ *
83
+ * If this configuration is not defined, the feature will use the following defaults instead:
84
+ *
85
+ * 1. If the {@glink features/headings Headings feature} is loaded, it equals
86
+ * * {@link module:heading/headingconfig~HeadingConfig#options `config.heading.options`}.
87
+ * * `[ 'heading1', 'heading2', 'heading3' ]` if `config.heading.options` is not defined.
88
+ * 2. If the {@glink features/html/general-html-support General HTML Support} feature is loaded, it equals
89
+ * `[ 'htmlH1', 'htmlH2', 'htmlH3', 'htmlH4', 'htmlH5', 'htmlH6' ]`.
90
+ *
91
+ * **Note**: The Headings feature takes precedence over the General HTML Support feature when
92
+ * both are loaded.
93
+ */
94
+ headings?: Array<string>;
95
+ /**
96
+ * Allows you to display a placeholder text: [Empty heading] for empty headings.
97
+ *
98
+ * By default, the display of a placeholder is disabled. To enable it, set this parameter to true.
99
+ *
100
+ * **Note**: This setting also affects Table of contents feature.
101
+ */
102
+ showEmptyHeadings?: boolean;
103
+ }
@@ -0,0 +1,44 @@
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
+ :root{
6
+ --ck-table-of-contents-padding:1em;
7
+ --ck-table-of-contents-line-height:1.5;
8
+ --ck-table-of-contents-items-start-padding:24px;
9
+ }
10
+
11
+ .ck-content .table-of-contents{
12
+ margin:0.9em auto;
13
+ }
14
+
15
+ .ck-content .table-of-contents.table-of-contents_empty{
16
+ display:none;
17
+ }
18
+
19
+ .ck-content .table-of-contents .table-of-contents__placeholder{
20
+ margin:0;
21
+ padding:var(--ck-table-of-contents-padding);
22
+ font-style:italic;
23
+ }
24
+
25
+ .ck-content .table-of-contents > ol{
26
+ padding:var(--ck-table-of-contents-padding);
27
+ }
28
+
29
+ .ck-content .table-of-contents ol{
30
+ margin:0;
31
+ line-height:var(--ck-table-of-contents-line-height);
32
+ list-style-type:none;
33
+ }
34
+
35
+ .ck-content .table-of-contents ol ol{
36
+ padding-inline-start:var(--ck-table-of-contents-items-start-padding);
37
+ }
38
+
39
+ .ck-content .table-of-contents ol li{
40
+ white-space:nowrap;
41
+ text-overflow:ellipsis;
42
+ overflow:hidden;
43
+ cursor:default;
44
+ }
@@ -0,0 +1,147 @@
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
+ :root{
6
+ --ck-document-outline-padding:var(--ck-spacing-large);
7
+ --ck-document-outline-base-font-size:.875em;
8
+ --ck-document-outline-placeholder-color:var(--ck-color-engine-placeholder-text);
9
+
10
+ --ck-document-outline-indent-level-1:0;
11
+ --ck-document-outline-indent-level-2:1.5em;
12
+ --ck-document-outline-indent-level-3:3em;
13
+ --ck-document-outline-indent-level-4:4.5em;
14
+ --ck-document-outline-indent-level-5:6em;
15
+ --ck-document-outline-indent-level-6:7.5em;
16
+
17
+ --ck-document-outline-item-padding:var(--ck-spacing-small);
18
+ --ck-document-outline-item-active-color:var(--ck-color-base-active);
19
+ --ck-document-outline-item-default-color:hsl(0, 0%, 26%);
20
+ --ck-document-outline-item-hover-state-color:var(--ck-color-base-text);
21
+ }
22
+
23
+ .ck.ck-document-outline{
24
+ padding:var(--ck-document-outline-padding);
25
+ font-size:var(--ck-document-outline-base-font-size);
26
+ user-select:none;
27
+ }
28
+
29
+ .ck.ck-document-outline:empty::before{
30
+ content:attr(data-document-outline-empty-placeholder);
31
+ display:inline-block;
32
+ color:var(--ck-document-outline-placeholder-color);
33
+ }
34
+
35
+ .ck.ck-document-outline .ck-document-outline__item{
36
+ padding:var(--ck-document-outline-item-padding);
37
+ color:var(--ck-document-outline-item-default-color);
38
+ white-space:nowrap;
39
+ text-overflow:ellipsis;
40
+ overflow:hidden;
41
+ cursor:pointer;
42
+ }
43
+
44
+ .ck.ck-document-outline .ck-document-outline__item.ck-document-outline__item_empty{
45
+ font-style:italic;
46
+ }
47
+
48
+ .ck.ck-document-outline .ck-document-outline__item.ck-document-outline__item_empty:hover,
49
+ .ck.ck-document-outline .ck-document-outline__item:hover{
50
+ color:var(--ck-document-outline-item-hover-state-color);
51
+ text-decoration:underline;
52
+ }
53
+
54
+ .ck.ck-document-outline .ck-document-outline__item.ck-document-outline__item_active{
55
+ color:var(--ck-document-outline-item-active-color);
56
+ }
57
+
58
+ .ck.ck-document-outline .ck-document-outline__item.ck-document-outline__item_level-1{
59
+ font-size:1.1em;
60
+ font-weight:bold;
61
+ }
62
+
63
+ .ck.ck-document-outline[dir="ltr"] .ck-document-outline__item.ck-document-outline__item_level-1{
64
+ padding-left:var(--ck-document-outline-indent-level-1);
65
+ }
66
+
67
+ .ck.ck-document-outline[dir="ltr"] .ck-document-outline__item.ck-document-outline__item_level-2{
68
+ padding-left:var(--ck-document-outline-indent-level-2);
69
+ }
70
+
71
+ .ck.ck-document-outline[dir="ltr"] .ck-document-outline__item.ck-document-outline__item_level-3{
72
+ padding-left:var(--ck-document-outline-indent-level-3);
73
+ }
74
+
75
+ .ck.ck-document-outline[dir="ltr"] .ck-document-outline__item.ck-document-outline__item_level-4{
76
+ padding-left:var(--ck-document-outline-indent-level-4);
77
+ }
78
+
79
+ .ck.ck-document-outline[dir="ltr"] .ck-document-outline__item.ck-document-outline__item_level-5{
80
+ padding-left:var(--ck-document-outline-indent-level-5);
81
+ }
82
+
83
+ .ck.ck-document-outline[dir="ltr"] .ck-document-outline__item.ck-document-outline__item_level-6{
84
+ padding-left:var(--ck-document-outline-indent-level-6);
85
+ }
86
+
87
+ .ck.ck-document-outline[dir="rtl"] .ck-document-outline__item.ck-document-outline__item_level-1{
88
+ padding-right:var(--ck-document-outline-indent-level-1);
89
+ }
90
+
91
+ .ck.ck-document-outline[dir="rtl"] .ck-document-outline__item.ck-document-outline__item_level-2{
92
+ padding-right:var(--ck-document-outline-indent-level-2);
93
+ }
94
+
95
+ .ck.ck-document-outline[dir="rtl"] .ck-document-outline__item.ck-document-outline__item_level-3{
96
+ padding-right:var(--ck-document-outline-indent-level-3);
97
+ }
98
+
99
+ .ck.ck-document-outline[dir="rtl"] .ck-document-outline__item.ck-document-outline__item_level-4{
100
+ padding-right:var(--ck-document-outline-indent-level-4);
101
+ }
102
+
103
+ .ck.ck-document-outline[dir="rtl"] .ck-document-outline__item.ck-document-outline__item_level-5{
104
+ padding-right:var(--ck-document-outline-indent-level-5);
105
+ }
106
+
107
+ .ck.ck-document-outline[dir="rtl"] .ck-document-outline__item.ck-document-outline__item_level-6{
108
+ padding-right:var(--ck-document-outline-indent-level-6);
109
+ }
110
+
111
+ :root{
112
+ --ck-table-of-contents-padding:1em;
113
+ --ck-table-of-contents-line-height:1.5;
114
+ --ck-table-of-contents-items-start-padding:24px;
115
+ --ck-table-of-contents-border-color:var(--ck-color-base-border);
116
+ --ck-table-of-contents-label-background-color:hsl(0, 0%, 46%);
117
+ --ck-table-of-contents-background-color:var(--ck-color-base-foreground);
118
+ }
119
+
120
+ .ck-editor__editable .ck-widget.table-of-contents{
121
+ position:relative;
122
+ background-color:var(--ck-table-of-contents-background-color);
123
+ border:1px solid var(--ck-table-of-contents-border-color);
124
+ display:flow-root;
125
+ min-width:15em;
126
+ }
127
+
128
+ .ck-editor__editable .ck-widget.table-of-contents[data-table-of-contents-label]::after{
129
+ content:attr(data-table-of-contents-label);
130
+
131
+ position:absolute;
132
+ top:-1px;
133
+ right:10px;
134
+ padding:var(--ck-spacing-tiny) var(--ck-spacing-medium);
135
+ background-color:var(--ck-table-of-contents-label-background-color);
136
+
137
+ font-size:10px;
138
+ font-family:var(--ck-font-face);
139
+ line-height:16px;
140
+ color:hsl(0, 0%, 100%);
141
+ white-space:nowrap;
142
+ }
143
+
144
+ [dir="rtl"] .ck-editor__editable .ck-widget.table-of-contents[data-table-of-contents-label]::after{
145
+ left:10px;
146
+ right:auto;
147
+ }