@ckeditor/ckeditor5-heading 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 (211) hide show
  1. package/build/translations/ti.js +1 -0
  2. package/dist/index-content.css +4 -0
  3. package/dist/index-editor.css +16 -0
  4. package/dist/index.css +26 -0
  5. package/dist/index.css.map +1 -0
  6. package/dist/index.js +860 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/translations/ar.d.ts +8 -0
  9. package/dist/translations/ar.js +5 -0
  10. package/dist/translations/ar.umd.js +11 -0
  11. package/dist/translations/az.d.ts +8 -0
  12. package/dist/translations/az.js +5 -0
  13. package/dist/translations/az.umd.js +11 -0
  14. package/dist/translations/bg.d.ts +8 -0
  15. package/dist/translations/bg.js +5 -0
  16. package/dist/translations/bg.umd.js +11 -0
  17. package/dist/translations/bn.d.ts +8 -0
  18. package/dist/translations/bn.js +5 -0
  19. package/dist/translations/bn.umd.js +11 -0
  20. package/dist/translations/bs.d.ts +8 -0
  21. package/dist/translations/bs.js +5 -0
  22. package/dist/translations/bs.umd.js +11 -0
  23. package/dist/translations/ca.d.ts +8 -0
  24. package/dist/translations/ca.js +5 -0
  25. package/dist/translations/ca.umd.js +11 -0
  26. package/dist/translations/cs.d.ts +8 -0
  27. package/dist/translations/cs.js +5 -0
  28. package/dist/translations/cs.umd.js +11 -0
  29. package/dist/translations/da.d.ts +8 -0
  30. package/dist/translations/da.js +5 -0
  31. package/dist/translations/da.umd.js +11 -0
  32. package/dist/translations/de-ch.d.ts +8 -0
  33. package/dist/translations/de-ch.js +5 -0
  34. package/dist/translations/de-ch.umd.js +11 -0
  35. package/dist/translations/de.d.ts +8 -0
  36. package/dist/translations/de.js +5 -0
  37. package/dist/translations/de.umd.js +11 -0
  38. package/dist/translations/el.d.ts +8 -0
  39. package/dist/translations/el.js +5 -0
  40. package/dist/translations/el.umd.js +11 -0
  41. package/dist/translations/en-au.d.ts +8 -0
  42. package/dist/translations/en-au.js +5 -0
  43. package/dist/translations/en-au.umd.js +11 -0
  44. package/dist/translations/en-gb.d.ts +8 -0
  45. package/dist/translations/en-gb.js +5 -0
  46. package/dist/translations/en-gb.umd.js +11 -0
  47. package/dist/translations/en.d.ts +8 -0
  48. package/dist/translations/en.js +5 -0
  49. package/dist/translations/en.umd.js +11 -0
  50. package/dist/translations/eo.d.ts +8 -0
  51. package/dist/translations/eo.js +5 -0
  52. package/dist/translations/eo.umd.js +11 -0
  53. package/dist/translations/es.d.ts +8 -0
  54. package/dist/translations/es.js +5 -0
  55. package/dist/translations/es.umd.js +11 -0
  56. package/dist/translations/et.d.ts +8 -0
  57. package/dist/translations/et.js +5 -0
  58. package/dist/translations/et.umd.js +11 -0
  59. package/dist/translations/eu.d.ts +8 -0
  60. package/dist/translations/eu.js +5 -0
  61. package/dist/translations/eu.umd.js +11 -0
  62. package/dist/translations/fa.d.ts +8 -0
  63. package/dist/translations/fa.js +5 -0
  64. package/dist/translations/fa.umd.js +11 -0
  65. package/dist/translations/fi.d.ts +8 -0
  66. package/dist/translations/fi.js +5 -0
  67. package/dist/translations/fi.umd.js +11 -0
  68. package/dist/translations/fr.d.ts +8 -0
  69. package/dist/translations/fr.js +5 -0
  70. package/dist/translations/fr.umd.js +11 -0
  71. package/dist/translations/gl.d.ts +8 -0
  72. package/dist/translations/gl.js +5 -0
  73. package/dist/translations/gl.umd.js +11 -0
  74. package/dist/translations/he.d.ts +8 -0
  75. package/dist/translations/he.js +5 -0
  76. package/dist/translations/he.umd.js +11 -0
  77. package/dist/translations/hi.d.ts +8 -0
  78. package/dist/translations/hi.js +5 -0
  79. package/dist/translations/hi.umd.js +11 -0
  80. package/dist/translations/hr.d.ts +8 -0
  81. package/dist/translations/hr.js +5 -0
  82. package/dist/translations/hr.umd.js +11 -0
  83. package/dist/translations/hu.d.ts +8 -0
  84. package/dist/translations/hu.js +5 -0
  85. package/dist/translations/hu.umd.js +11 -0
  86. package/dist/translations/hy.d.ts +8 -0
  87. package/dist/translations/hy.js +5 -0
  88. package/dist/translations/hy.umd.js +11 -0
  89. package/dist/translations/id.d.ts +8 -0
  90. package/dist/translations/id.js +5 -0
  91. package/dist/translations/id.umd.js +11 -0
  92. package/dist/translations/it.d.ts +8 -0
  93. package/dist/translations/it.js +5 -0
  94. package/dist/translations/it.umd.js +11 -0
  95. package/dist/translations/ja.d.ts +8 -0
  96. package/dist/translations/ja.js +5 -0
  97. package/dist/translations/ja.umd.js +11 -0
  98. package/dist/translations/jv.d.ts +8 -0
  99. package/dist/translations/jv.js +5 -0
  100. package/dist/translations/jv.umd.js +11 -0
  101. package/dist/translations/km.d.ts +8 -0
  102. package/dist/translations/km.js +5 -0
  103. package/dist/translations/km.umd.js +11 -0
  104. package/dist/translations/kn.d.ts +8 -0
  105. package/dist/translations/kn.js +5 -0
  106. package/dist/translations/kn.umd.js +11 -0
  107. package/dist/translations/ko.d.ts +8 -0
  108. package/dist/translations/ko.js +5 -0
  109. package/dist/translations/ko.umd.js +11 -0
  110. package/dist/translations/ku.d.ts +8 -0
  111. package/dist/translations/ku.js +5 -0
  112. package/dist/translations/ku.umd.js +11 -0
  113. package/dist/translations/lt.d.ts +8 -0
  114. package/dist/translations/lt.js +5 -0
  115. package/dist/translations/lt.umd.js +11 -0
  116. package/dist/translations/lv.d.ts +8 -0
  117. package/dist/translations/lv.js +5 -0
  118. package/dist/translations/lv.umd.js +11 -0
  119. package/dist/translations/ms.d.ts +8 -0
  120. package/dist/translations/ms.js +5 -0
  121. package/dist/translations/ms.umd.js +11 -0
  122. package/dist/translations/nb.d.ts +8 -0
  123. package/dist/translations/nb.js +5 -0
  124. package/dist/translations/nb.umd.js +11 -0
  125. package/dist/translations/ne.d.ts +8 -0
  126. package/dist/translations/ne.js +5 -0
  127. package/dist/translations/ne.umd.js +11 -0
  128. package/dist/translations/nl.d.ts +8 -0
  129. package/dist/translations/nl.js +5 -0
  130. package/dist/translations/nl.umd.js +11 -0
  131. package/dist/translations/no.d.ts +8 -0
  132. package/dist/translations/no.js +5 -0
  133. package/dist/translations/no.umd.js +11 -0
  134. package/dist/translations/pl.d.ts +8 -0
  135. package/dist/translations/pl.js +5 -0
  136. package/dist/translations/pl.umd.js +11 -0
  137. package/dist/translations/pt-br.d.ts +8 -0
  138. package/dist/translations/pt-br.js +5 -0
  139. package/dist/translations/pt-br.umd.js +11 -0
  140. package/dist/translations/pt.d.ts +8 -0
  141. package/dist/translations/pt.js +5 -0
  142. package/dist/translations/pt.umd.js +11 -0
  143. package/dist/translations/ro.d.ts +8 -0
  144. package/dist/translations/ro.js +5 -0
  145. package/dist/translations/ro.umd.js +11 -0
  146. package/dist/translations/ru.d.ts +8 -0
  147. package/dist/translations/ru.js +5 -0
  148. package/dist/translations/ru.umd.js +11 -0
  149. package/dist/translations/sk.d.ts +8 -0
  150. package/dist/translations/sk.js +5 -0
  151. package/dist/translations/sk.umd.js +11 -0
  152. package/dist/translations/sl.d.ts +8 -0
  153. package/dist/translations/sl.js +5 -0
  154. package/dist/translations/sl.umd.js +11 -0
  155. package/dist/translations/sq.d.ts +8 -0
  156. package/dist/translations/sq.js +5 -0
  157. package/dist/translations/sq.umd.js +11 -0
  158. package/dist/translations/sr-latn.d.ts +8 -0
  159. package/dist/translations/sr-latn.js +5 -0
  160. package/dist/translations/sr-latn.umd.js +11 -0
  161. package/dist/translations/sr.d.ts +8 -0
  162. package/dist/translations/sr.js +5 -0
  163. package/dist/translations/sr.umd.js +11 -0
  164. package/dist/translations/sv.d.ts +8 -0
  165. package/dist/translations/sv.js +5 -0
  166. package/dist/translations/sv.umd.js +11 -0
  167. package/dist/translations/th.d.ts +8 -0
  168. package/dist/translations/th.js +5 -0
  169. package/dist/translations/th.umd.js +11 -0
  170. package/dist/translations/ti.d.ts +8 -0
  171. package/dist/translations/ti.js +5 -0
  172. package/dist/translations/ti.umd.js +11 -0
  173. package/dist/translations/tk.d.ts +8 -0
  174. package/dist/translations/tk.js +5 -0
  175. package/dist/translations/tk.umd.js +11 -0
  176. package/dist/translations/tr.d.ts +8 -0
  177. package/dist/translations/tr.js +5 -0
  178. package/dist/translations/tr.umd.js +11 -0
  179. package/dist/translations/ug.d.ts +8 -0
  180. package/dist/translations/ug.js +5 -0
  181. package/dist/translations/ug.umd.js +11 -0
  182. package/dist/translations/uk.d.ts +8 -0
  183. package/dist/translations/uk.js +5 -0
  184. package/dist/translations/uk.umd.js +11 -0
  185. package/dist/translations/ur.d.ts +8 -0
  186. package/dist/translations/ur.js +5 -0
  187. package/dist/translations/ur.umd.js +11 -0
  188. package/dist/translations/uz.d.ts +8 -0
  189. package/dist/translations/uz.js +5 -0
  190. package/dist/translations/uz.umd.js +11 -0
  191. package/dist/translations/vi.d.ts +8 -0
  192. package/dist/translations/vi.js +5 -0
  193. package/dist/translations/vi.umd.js +11 -0
  194. package/dist/translations/zh-cn.d.ts +8 -0
  195. package/dist/translations/zh-cn.js +5 -0
  196. package/dist/translations/zh-cn.umd.js +11 -0
  197. package/dist/translations/zh.d.ts +8 -0
  198. package/dist/translations/zh.js +5 -0
  199. package/dist/translations/zh.umd.js +11 -0
  200. package/dist/types/augmentation.d.ts +34 -0
  201. package/dist/types/heading.d.ts +36 -0
  202. package/dist/types/headingbuttonsui.d.ts +55 -0
  203. package/dist/types/headingcommand.d.ts +52 -0
  204. package/dist/types/headingconfig.d.ts +149 -0
  205. package/dist/types/headingediting.d.ts +46 -0
  206. package/dist/types/headingui.d.ts +26 -0
  207. package/dist/types/index.d.ts +20 -0
  208. package/dist/types/title.d.ts +119 -0
  209. package/dist/types/utils.d.ts +22 -0
  210. package/lang/translations/ti.po +62 -0
  211. package/package.json +3 -2
@@ -0,0 +1,5 @@
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
+ export default {"vi":{"dictionary":{"Paragraph":"Đoạn văn","Heading":"Tiêu đề","Choose heading":"Chọn tiêu đề","Heading 1":"Tiêu đề 1","Heading 2":"Tiêu đề 2","Heading 3":"Tiêu đề 3","Heading 4":"Tiêu đề 4","Heading 5":"Tiêu đề 5","Heading 6":"Tiêu đề 6","Type your title":"Nhập tựa đề","Type or paste your content here.":"Nhập hoặc dán nội dung tại đây"},getPluralForm(n){return 0;}}}
@@ -0,0 +1,11 @@
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
+ ( e => {
7
+ const { [ 'vi' ]: { dictionary, getPluralForm } } = {"vi":{"dictionary":{"Paragraph":"Đoạn văn","Heading":"Tiêu đề","Choose heading":"Chọn tiêu đề","Heading 1":"Tiêu đề 1","Heading 2":"Tiêu đề 2","Heading 3":"Tiêu đề 3","Heading 4":"Tiêu đề 4","Heading 5":"Tiêu đề 5","Heading 6":"Tiêu đề 6","Type your title":"Nhập tựa đề","Type or paste your content here.":"Nhập hoặc dán nội dung tại đây"},getPluralForm(n){return 0;}}};
8
+ e[ 'vi' ] ||= { dictionary: {}, getPluralForm: null };
9
+ e[ 'vi' ].dictionary = Object.assign( e[ 'vi' ].dictionary, dictionary );
10
+ e[ 'vi' ].getPluralForm = getPluralForm;
11
+ } )( window.CKEDITOR_TRANSLATIONS ||= {} );
@@ -0,0 +1,8 @@
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
+ import type { Translations } from 'ckeditor5';
7
+ declare const translations: Translations;
8
+ export default translations;
@@ -0,0 +1,5 @@
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
+ export default {"zh-cn":{"dictionary":{"Paragraph":"段落","Heading":"标题","Choose heading":"标题类型","Heading 1":"标题 1","Heading 2":"标题 2","Heading 3":"标题 3","Heading 4":"标题 4","Heading 5":"标题 5","Heading 6":"标题 6","Type your title":"输入标题","Type or paste your content here.":"在这里输入或粘贴内容"},getPluralForm(n){return 0;}}}
@@ -0,0 +1,11 @@
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
+ ( e => {
7
+ const { [ 'zh-cn' ]: { dictionary, getPluralForm } } = {"zh-cn":{"dictionary":{"Paragraph":"段落","Heading":"标题","Choose heading":"标题类型","Heading 1":"标题 1","Heading 2":"标题 2","Heading 3":"标题 3","Heading 4":"标题 4","Heading 5":"标题 5","Heading 6":"标题 6","Type your title":"输入标题","Type or paste your content here.":"在这里输入或粘贴内容"},getPluralForm(n){return 0;}}};
8
+ e[ 'zh-cn' ] ||= { dictionary: {}, getPluralForm: null };
9
+ e[ 'zh-cn' ].dictionary = Object.assign( e[ 'zh-cn' ].dictionary, dictionary );
10
+ e[ 'zh-cn' ].getPluralForm = getPluralForm;
11
+ } )( window.CKEDITOR_TRANSLATIONS ||= {} );
@@ -0,0 +1,8 @@
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
+ import type { Translations } from 'ckeditor5';
7
+ declare const translations: Translations;
8
+ export default translations;
@@ -0,0 +1,5 @@
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
+ export default {"zh":{"dictionary":{"Paragraph":"段落","Heading":"標題","Choose heading":"選取標題","Heading 1":"標題 1","Heading 2":"標題 2","Heading 3":"標題 3","Heading 4":"標題 4","Heading 5":"標題 5","Heading 6":"標題 6","Type your title":"輸入你的標題","Type or paste your content here.":"在此輸入或貼上你的內容。"},getPluralForm(n){return 0;}}}
@@ -0,0 +1,11 @@
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
+ ( e => {
7
+ const { [ 'zh' ]: { dictionary, getPluralForm } } = {"zh":{"dictionary":{"Paragraph":"段落","Heading":"標題","Choose heading":"選取標題","Heading 1":"標題 1","Heading 2":"標題 2","Heading 3":"標題 3","Heading 4":"標題 4","Heading 5":"標題 5","Heading 6":"標題 6","Type your title":"輸入你的標題","Type or paste your content here.":"在此輸入或貼上你的內容。"},getPluralForm(n){return 0;}}};
8
+ e[ 'zh' ] ||= { dictionary: {}, getPluralForm: null };
9
+ e[ 'zh' ].dictionary = Object.assign( e[ 'zh' ].dictionary, dictionary );
10
+ e[ 'zh' ].getPluralForm = getPluralForm;
11
+ } )( window.CKEDITOR_TRANSLATIONS ||= {} );
@@ -0,0 +1,34 @@
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
+ import type { Heading, HeadingCommand, HeadingConfig, HeadingEditing, HeadingUI, Title, TitleConfig } from './index.js';
10
+ declare module '@ckeditor/ckeditor5-core' {
11
+ interface EditorConfig {
12
+ /**
13
+ * The configuration of the heading feature. Introduced by the {@link module:heading/headingediting~HeadingEditing} feature.
14
+ *
15
+ * Read more in {@link module:heading/headingconfig~HeadingConfig}.
16
+ */
17
+ heading?: HeadingConfig;
18
+ /**
19
+ * The configuration of the {@link module:heading/title~Title title feature}.
20
+ *
21
+ * Read more in {@link module:heading/title~TitleConfig}.
22
+ */
23
+ title?: TitleConfig;
24
+ }
25
+ interface PluginsMap {
26
+ [Heading.pluginName]: Heading;
27
+ [HeadingEditing.pluginName]: HeadingEditing;
28
+ [HeadingUI.pluginName]: HeadingUI;
29
+ [Title.pluginName]: Title;
30
+ }
31
+ interface CommandsMap {
32
+ heading: HeadingCommand;
33
+ }
34
+ }
@@ -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 heading/heading
11
+ */
12
+ import { Plugin } from 'ckeditor5/src/core.js';
13
+ import HeadingEditing from './headingediting.js';
14
+ import HeadingUI from './headingui.js';
15
+ import '../theme/heading.css';
16
+ /**
17
+ * The headings feature.
18
+ *
19
+ * For a detailed overview, check the {@glink features/headings Headings feature} guide
20
+ * and the {@glink api/heading package page}.
21
+ *
22
+ * This is a "glue" plugin which loads the {@link module:heading/headingediting~HeadingEditing heading editing feature}
23
+ * and {@link module:heading/headingui~HeadingUI heading UI feature}.
24
+ *
25
+ * @extends module:core/plugin~Plugin
26
+ */
27
+ export default class Heading extends Plugin {
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ static get requires(): readonly [typeof HeadingEditing, typeof HeadingUI];
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ static get pluginName(): "Heading";
36
+ }
@@ -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 heading/headingbuttonsui
11
+ */
12
+ import { Plugin } from 'ckeditor5/src/core.js';
13
+ /**
14
+ * The `HeadingButtonsUI` plugin defines a set of UI buttons that can be used instead of the
15
+ * standard drop down component.
16
+ *
17
+ * This feature is not enabled by default by the {@link module:heading/heading~Heading} plugin and needs to be
18
+ * installed manually to the editor configuration.
19
+ *
20
+ * Plugin introduces button UI elements, which names are same as `model` property from {@link module:heading/headingconfig~HeadingOption}.
21
+ *
22
+ * ```ts
23
+ * ClassicEditor
24
+ * .create( {
25
+ * plugins: [ ..., Heading, Paragraph, HeadingButtonsUI, ParagraphButtonUI ]
26
+ * heading: {
27
+ * options: [
28
+ * { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
29
+ * { model: 'heading1', view: 'h2', title: 'Heading 1', class: 'ck-heading_heading1' },
30
+ * { model: 'heading2', view: 'h3', title: 'Heading 2', class: 'ck-heading_heading2' },
31
+ * { model: 'heading3', view: 'h4', title: 'Heading 3', class: 'ck-heading_heading3' }
32
+ * ]
33
+ * },
34
+ * toolbar: [ 'paragraph', 'heading1', 'heading2', 'heading3' ]
35
+ * } )
36
+ * .then( ... )
37
+ * .catch( ... );
38
+ * ```
39
+ *
40
+ * NOTE: The `'paragraph'` button is defined in by the {@link module:paragraph/paragraphbuttonui~ParagraphButtonUI} plugin
41
+ * which needs to be loaded manually as well.
42
+ *
43
+ * It is possible to use custom icons by providing `icon` config option in {@link module:heading/headingconfig~HeadingOption}.
44
+ * For the default configuration standard icons are used.
45
+ */
46
+ export default class HeadingButtonsUI extends Plugin {
47
+ /**
48
+ * @inheritDoc
49
+ */
50
+ init(): void;
51
+ /**
52
+ * Creates single button view from provided configuration option.
53
+ */
54
+ private _createButton;
55
+ }
@@ -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 heading/headingcommand
11
+ */
12
+ import { Command, type Editor } from 'ckeditor5/src/core.js';
13
+ /**
14
+ * The heading command. It is used by the {@link module:heading/heading~Heading heading feature} to apply headings.
15
+ */
16
+ export default class HeadingCommand extends Command {
17
+ /**
18
+ * If the selection starts in a heading (which {@link #modelElements is supported by this command})
19
+ * the value is set to the name of that heading model element.
20
+ * It is set to `false` otherwise.
21
+ *
22
+ * @observable
23
+ * @readonly
24
+ */
25
+ value: false | string;
26
+ /**
27
+ * Set of defined model's elements names that this command support.
28
+ * See {@link module:heading/headingconfig~HeadingOption}.
29
+ */
30
+ readonly modelElements: Array<string>;
31
+ /**
32
+ * Creates an instance of the command.
33
+ *
34
+ * @param editor Editor instance.
35
+ * @param modelElements Names of the element which this command can apply in the model.
36
+ */
37
+ constructor(editor: Editor, modelElements: Array<string>);
38
+ /**
39
+ * @inheritDoc
40
+ */
41
+ refresh(): void;
42
+ /**
43
+ * Executes the command. Applies the heading to the selected blocks or, if the first selected
44
+ * block is a heading already, turns selected headings (of this level only) to paragraphs.
45
+ *
46
+ * @param options.value Name of the element which this command will apply in the model.
47
+ * @fires execute
48
+ */
49
+ execute(options: {
50
+ value: string;
51
+ }): void;
52
+ }
@@ -0,0 +1,149 @@
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 heading/headingconfig
11
+ */
12
+ import type { ArrayOrItem } from 'ckeditor5/src/utils.js';
13
+ import type { MatcherPattern, ViewElementDefinition } from 'ckeditor5/src/engine.js';
14
+ /**
15
+ * The configuration of the heading feature.
16
+ * The option is used by the {@link module:heading/headingediting~HeadingEditing} feature.
17
+ *
18
+ * ```ts
19
+ * ClassicEditor
20
+ * .create( {
21
+ * heading: ... // Heading feature config.
22
+ * } )
23
+ * .then( ... )
24
+ * .catch( ... );
25
+ * ```
26
+ *
27
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
28
+ */
29
+ export interface HeadingConfig {
30
+ /**
31
+ * The available heading options.
32
+ *
33
+ * The default value is:
34
+ * ```ts
35
+ * const headingConfig = {
36
+ * options: [
37
+ * { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
38
+ * { model: 'heading1', view: 'h2', title: 'Heading 1', class: 'ck-heading_heading1' },
39
+ * { model: 'heading2', view: 'h3', title: 'Heading 2', class: 'ck-heading_heading2' },
40
+ * { model: 'heading3', view: 'h4', title: 'Heading 3', class: 'ck-heading_heading3' }
41
+ * ]
42
+ * };
43
+ * ```
44
+ *
45
+ * It defines 3 levels of headings. In the editor model they will use `heading1`, `heading2`, and `heading3` elements.
46
+ * Their respective view elements (so the elements output by the editor) will be: `h2`, `h3`, and `h4`. This means that
47
+ * if you choose "Heading 1" in the headings dropdown the editor will turn the current block to `<heading1>` in the model
48
+ * which will result in rendering (and outputting to data) the `<h2>` element.
49
+ *
50
+ * The `title` and `class` properties will be used by the `headings` dropdown to render available options.
51
+ * Usually, the first option in the headings dropdown is the "Paragraph" option, hence it's also defined on the list.
52
+ * However, you don't need to define its view representation because it's handled by
53
+ * the {@link module:paragraph/paragraph~Paragraph} feature (which is required by
54
+ * the {@link module:heading/headingediting~HeadingEditing} feature).
55
+ *
56
+ * You can **read more** about configuring heading levels and **see more examples** in
57
+ * the {@glink features/headings Headings} guide.
58
+ *
59
+ * Note: In the model you should always start from `heading1`, regardless of how the headings are represented in the view.
60
+ * That's assumption is used by features like {@link module:autoformat/autoformat~Autoformat} to know which element
61
+ * they should use when applying the first level heading.
62
+ *
63
+ * The defined headings are also available as values passed to the `'heading'` command under their model names.
64
+ * For example, the below code will apply `<heading1>` to the current selection:
65
+ *
66
+ * ```ts
67
+ * editor.execute( 'heading', { value: 'heading1' } );
68
+ * ```
69
+ */
70
+ options?: Array<HeadingOption>;
71
+ }
72
+ /**
73
+ * Heading option descriptor.
74
+ */
75
+ export type HeadingOption = HeadingElementOption | HeadingParagraphOption | HeadingCustomElementOption;
76
+ export interface HeadingElementOption {
77
+ /**
78
+ * Name of the model element to convert.
79
+ */
80
+ model: 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6';
81
+ /**
82
+ * Definition of a view element to convert from/to.
83
+ */
84
+ view: ViewElementDefinition;
85
+ /**
86
+ * The user-readable title of the option.
87
+ */
88
+ title: string;
89
+ /**
90
+ * The class which will be added to the dropdown item representing this option.
91
+ */
92
+ class: string;
93
+ /**
94
+ * Icon used by {@link module:heading/headingbuttonsui~HeadingButtonsUI}. It can be omitted when using the default configuration.
95
+ */
96
+ icon?: string;
97
+ /**
98
+ * An array with all matched elements that the view-to-model conversion should also accept.
99
+ */
100
+ upcastAlso?: ArrayOrItem<ViewElementDefinition | MatcherPattern>;
101
+ }
102
+ export interface HeadingCustomElementOption {
103
+ /**
104
+ * Name of the model element to convert.
105
+ */
106
+ model: `heading${string}`;
107
+ /**
108
+ * Definition of a view element to convert from/to.
109
+ */
110
+ view: ViewElementDefinition;
111
+ /**
112
+ * The user-readable title of the option.
113
+ */
114
+ title: string;
115
+ /**
116
+ * The class which will be added to the dropdown item representing this option.
117
+ */
118
+ class: string;
119
+ /**
120
+ * Icon used by {@link module:heading/headingbuttonsui~HeadingButtonsUI}. It can be omitted when using the default configuration.
121
+ */
122
+ icon?: string;
123
+ /**
124
+ * An array with all matched elements that the view-to-model conversion should also accept.
125
+ */
126
+ upcastAlso?: ArrayOrItem<ViewElementDefinition | MatcherPattern>;
127
+ }
128
+ export interface HeadingParagraphOption {
129
+ /**
130
+ * Name of the model element to convert.
131
+ */
132
+ model: 'paragraph';
133
+ /**
134
+ * The user-readable title of the option.
135
+ */
136
+ title: string;
137
+ /**
138
+ * The class which will be added to the dropdown item representing this option.
139
+ * */
140
+ class: string;
141
+ /**
142
+ * Icon used by {@link module:heading/headingbuttonsui~HeadingButtonsUI}. It can be omitted when using the default configuration.
143
+ */
144
+ icon?: string;
145
+ /**
146
+ * An array with all matched elements that the view-to-model conversion should also accept.
147
+ */
148
+ upcastAlso?: ArrayOrItem<ViewElementDefinition | MatcherPattern>;
149
+ }
@@ -0,0 +1,46 @@
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 heading/headingediting
11
+ */
12
+ import { Plugin, type Editor } from 'ckeditor5/src/core.js';
13
+ import { Paragraph } from 'ckeditor5/src/paragraph.js';
14
+ /**
15
+ * The headings engine feature. It handles switching between block formats &ndash; headings and paragraph.
16
+ * This class represents the engine part of the heading feature. See also {@link module:heading/heading~Heading}.
17
+ * It introduces `heading1`-`headingN` commands which allow to convert paragraphs into headings.
18
+ */
19
+ export default class HeadingEditing extends Plugin {
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get pluginName(): "HeadingEditing";
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ constructor(editor: Editor);
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ static get requires(): readonly [typeof Paragraph];
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ init(): void;
36
+ /**
37
+ * @inheritDoc
38
+ */
39
+ afterInit(): void;
40
+ /**
41
+ * Adds default conversion for `h1` -> `heading1` with a low priority.
42
+ *
43
+ * @param editor Editor instance on which to add the `h1` conversion.
44
+ */
45
+ private _addDefaultH1Conversion;
46
+ }
@@ -0,0 +1,26 @@
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 heading/headingui
11
+ */
12
+ import { Plugin } from 'ckeditor5/src/core.js';
13
+ import '../theme/heading.css';
14
+ /**
15
+ * The headings UI feature. It introduces the `headings` dropdown.
16
+ */
17
+ export default class HeadingUI extends Plugin {
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get pluginName(): "HeadingUI";
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ init(): void;
26
+ }
@@ -0,0 +1,20 @@
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 heading
11
+ */
12
+ export { default as Heading } from './heading.js';
13
+ export type { HeadingOption, HeadingElementOption } from './headingconfig.js';
14
+ export { default as HeadingEditing } from './headingediting.js';
15
+ export { default as HeadingUI } from './headingui.js';
16
+ export { default as HeadingButtonsUI } from './headingbuttonsui.js';
17
+ export { default as Title, type TitleConfig } from './title.js';
18
+ export type { HeadingConfig } from './headingconfig.js';
19
+ export type { default as HeadingCommand } from './headingcommand.js';
20
+ import './augmentation.js';
@@ -0,0 +1,119 @@
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 heading/title
11
+ */
12
+ import { Plugin } from 'ckeditor5/src/core.js';
13
+ /**
14
+ * The Title plugin.
15
+ *
16
+ * It splits the document into `Title` and `Body` sections.
17
+ */
18
+ export default class Title extends Plugin {
19
+ /**
20
+ * A reference to an empty paragraph in the body
21
+ * created when there is no element in the body for the placeholder purposes.
22
+ */
23
+ private _bodyPlaceholder;
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ static get pluginName(): "Title";
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ static get requires(): readonly ["Paragraph"];
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ init(): void;
36
+ /**
37
+ * Returns the title of the document. Note that because this plugin does not allow any formatting inside
38
+ * the title element, the output of this method will be a plain text, with no HTML tags.
39
+ *
40
+ * It is not recommended to use this method together with features that insert markers to the
41
+ * data output, like comments or track changes features. If such markers start in the title and end in the
42
+ * body, the result of this method might be incorrect.
43
+ *
44
+ * @param options Additional configuration passed to the conversion process.
45
+ * See {@link module:engine/controller/datacontroller~DataController#get `DataController#get`}.
46
+ * @returns The title of the document.
47
+ */
48
+ getTitle(options?: Record<string, unknown>): string;
49
+ /**
50
+ * Returns the body of the document.
51
+ *
52
+ * Note that it is not recommended to use this method together with features that insert markers to the
53
+ * data output, like comments or track changes features. If such markers start in the title and end in the
54
+ * body, the result of this method might be incorrect.
55
+ *
56
+ * @param options Additional configuration passed to the conversion process.
57
+ * See {@link module:engine/controller/datacontroller~DataController#get `DataController#get`}.
58
+ * @returns The body of the document.
59
+ */
60
+ getBody(options?: Record<string, unknown>): string;
61
+ /**
62
+ * Returns the `title` element when it is in the document. Returns `undefined` otherwise.
63
+ */
64
+ private _getTitleElement;
65
+ /**
66
+ * Model post-fixer callback that ensures that `title` has only one `title-content` child.
67
+ * All additional children should be moved after the `title` element and renamed to a paragraph.
68
+ */
69
+ private _fixTitleContent;
70
+ /**
71
+ * Model post-fixer callback that creates a title element when it is missing,
72
+ * takes care of the correct position of it and removes additional title elements.
73
+ */
74
+ private _fixTitleElement;
75
+ /**
76
+ * Model post-fixer callback that adds an empty paragraph at the end of the document
77
+ * when it is needed for the placeholder purposes.
78
+ */
79
+ private _fixBodyElement;
80
+ /**
81
+ * Model post-fixer callback that removes a paragraph from the end of the document
82
+ * if it was created for the placeholder purposes and is not needed anymore.
83
+ */
84
+ private _fixExtraParagraph;
85
+ /**
86
+ * Attaches the `Title` and `Body` placeholders to the title and/or content.
87
+ */
88
+ private _attachPlaceholders;
89
+ /**
90
+ * Creates navigation between the title and body sections using <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.
91
+ */
92
+ private _attachTabPressHandling;
93
+ }
94
+ /**
95
+ * The configuration of the {@link module:heading/title~Title title feature}.
96
+ *
97
+ * ```ts
98
+ * ClassicEditor
99
+ * .create( document.querySelector( '#editor' ), {
100
+ * plugins: [ Title, ... ],
101
+ * title: {
102
+ * placeholder: 'My custom placeholder for the title'
103
+ * },
104
+ * placeholder: 'My custom placeholder for the body'
105
+ * } )
106
+ * .then( ... )
107
+ * .catch( ... );
108
+ * ```
109
+ *
110
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.
111
+ */
112
+ export interface TitleConfig {
113
+ /**
114
+ * Defines a custom value of the placeholder for the title field.
115
+ *
116
+ * Read more in {@link module:heading/title~TitleConfig}.
117
+ */
118
+ placeholder?: string;
119
+ }
@@ -0,0 +1,22 @@
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 heading/utils
11
+ */
12
+ import type { Editor } from 'ckeditor5/src/core.js';
13
+ import type { HeadingOption } from './headingconfig.js';
14
+ /**
15
+ * Returns heading options as defined in `config.heading.options` but processed to consider
16
+ * the editor localization, i.e. to display {@link module:heading/headingconfig~HeadingOption}
17
+ * in the correct language.
18
+ *
19
+ * Note: The reason behind this method is that there is no way to use {@link module:utils/locale~Locale#t}
20
+ * when the user configuration is defined because the editor does not exist yet.
21
+ */
22
+ export declare function getLocalizedOptions(editor: Editor): Array<HeadingOption>;