@ckeditor/ckeditor5-heading 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.
- package/CHANGELOG.md +4 -0
- package/LICENSE.md +17 -0
- package/README.md +26 -0
- package/build/heading.js +5 -0
- package/build/translations/ar.js +1 -0
- package/build/translations/az.js +1 -0
- package/build/translations/bg.js +1 -0
- package/build/translations/bn.js +1 -0
- package/build/translations/bs.js +1 -0
- package/build/translations/ca.js +1 -0
- package/build/translations/cs.js +1 -0
- package/build/translations/da.js +1 -0
- package/build/translations/de-ch.js +1 -0
- package/build/translations/de.js +1 -0
- package/build/translations/el.js +1 -0
- package/build/translations/en-au.js +1 -0
- package/build/translations/en-gb.js +1 -0
- package/build/translations/eo.js +1 -0
- package/build/translations/es.js +1 -0
- package/build/translations/et.js +1 -0
- package/build/translations/eu.js +1 -0
- package/build/translations/fa.js +1 -0
- package/build/translations/fi.js +1 -0
- package/build/translations/fr.js +1 -0
- package/build/translations/gl.js +1 -0
- package/build/translations/he.js +1 -0
- package/build/translations/hi.js +1 -0
- package/build/translations/hr.js +1 -0
- package/build/translations/hu.js +1 -0
- package/build/translations/hy.js +1 -0
- package/build/translations/id.js +1 -0
- package/build/translations/it.js +1 -0
- package/build/translations/ja.js +1 -0
- package/build/translations/jv.js +1 -0
- package/build/translations/km.js +1 -0
- package/build/translations/kn.js +1 -0
- package/build/translations/ko.js +1 -0
- package/build/translations/ku.js +1 -0
- package/build/translations/lt.js +1 -0
- package/build/translations/lv.js +1 -0
- package/build/translations/ms.js +1 -0
- package/build/translations/nb.js +1 -0
- package/build/translations/ne.js +1 -0
- package/build/translations/nl.js +1 -0
- package/build/translations/no.js +1 -0
- package/build/translations/pl.js +1 -0
- package/build/translations/pt-br.js +1 -0
- package/build/translations/pt.js +1 -0
- package/build/translations/ro.js +1 -0
- package/build/translations/ru.js +1 -0
- package/build/translations/sk.js +1 -0
- package/build/translations/sl.js +1 -0
- package/build/translations/sq.js +1 -0
- package/build/translations/sr-latn.js +1 -0
- package/build/translations/sr.js +1 -0
- package/build/translations/sv.js +1 -0
- package/build/translations/th.js +1 -0
- package/build/translations/ti.js +1 -0
- package/build/translations/tk.js +1 -0
- package/build/translations/tr.js +1 -0
- package/build/translations/ug.js +1 -0
- package/build/translations/uk.js +1 -0
- package/build/translations/ur.js +1 -0
- package/build/translations/uz.js +1 -0
- package/build/translations/vi.js +1 -0
- package/build/translations/zh-cn.js +1 -0
- package/build/translations/zh.js +1 -0
- package/ckeditor5-metadata.json +46 -0
- package/dist/augmentation.d.ts +34 -0
- package/dist/heading.d.ts +40 -0
- package/dist/headingbuttonsui.d.ts +55 -0
- package/dist/headingcommand.d.ts +52 -0
- package/dist/headingconfig.d.ts +123 -0
- package/dist/headingediting.d.ts +50 -0
- package/dist/headingui.d.ts +30 -0
- package/dist/index-content.css +4 -0
- package/dist/index-editor.css +19 -0
- package/dist/index.css +26 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +937 -0
- package/dist/index.js.map +1 -0
- package/dist/title.d.ts +123 -0
- package/dist/translations/ar.d.ts +8 -0
- package/dist/translations/ar.js +5 -0
- package/dist/translations/ar.umd.js +11 -0
- package/dist/translations/az.d.ts +8 -0
- package/dist/translations/az.js +5 -0
- package/dist/translations/az.umd.js +11 -0
- package/dist/translations/bg.d.ts +8 -0
- package/dist/translations/bg.js +5 -0
- package/dist/translations/bg.umd.js +11 -0
- package/dist/translations/bn.d.ts +8 -0
- package/dist/translations/bn.js +5 -0
- package/dist/translations/bn.umd.js +11 -0
- package/dist/translations/bs.d.ts +8 -0
- package/dist/translations/bs.js +5 -0
- package/dist/translations/bs.umd.js +11 -0
- package/dist/translations/ca.d.ts +8 -0
- package/dist/translations/ca.js +5 -0
- package/dist/translations/ca.umd.js +11 -0
- package/dist/translations/cs.d.ts +8 -0
- package/dist/translations/cs.js +5 -0
- package/dist/translations/cs.umd.js +11 -0
- package/dist/translations/da.d.ts +8 -0
- package/dist/translations/da.js +5 -0
- package/dist/translations/da.umd.js +11 -0
- package/dist/translations/de-ch.d.ts +8 -0
- package/dist/translations/de-ch.js +5 -0
- package/dist/translations/de-ch.umd.js +11 -0
- package/dist/translations/de.d.ts +8 -0
- package/dist/translations/de.js +5 -0
- package/dist/translations/de.umd.js +11 -0
- package/dist/translations/el.d.ts +8 -0
- package/dist/translations/el.js +5 -0
- package/dist/translations/el.umd.js +11 -0
- package/dist/translations/en-au.d.ts +8 -0
- package/dist/translations/en-au.js +5 -0
- package/dist/translations/en-au.umd.js +11 -0
- package/dist/translations/en-gb.d.ts +8 -0
- package/dist/translations/en-gb.js +5 -0
- package/dist/translations/en-gb.umd.js +11 -0
- package/dist/translations/en.d.ts +8 -0
- package/dist/translations/en.js +5 -0
- package/dist/translations/en.umd.js +11 -0
- package/dist/translations/eo.d.ts +8 -0
- package/dist/translations/eo.js +5 -0
- package/dist/translations/eo.umd.js +11 -0
- package/dist/translations/es.d.ts +8 -0
- package/dist/translations/es.js +5 -0
- package/dist/translations/es.umd.js +11 -0
- package/dist/translations/et.d.ts +8 -0
- package/dist/translations/et.js +5 -0
- package/dist/translations/et.umd.js +11 -0
- package/dist/translations/eu.d.ts +8 -0
- package/dist/translations/eu.js +5 -0
- package/dist/translations/eu.umd.js +11 -0
- package/dist/translations/fa.d.ts +8 -0
- package/dist/translations/fa.js +5 -0
- package/dist/translations/fa.umd.js +11 -0
- package/dist/translations/fi.d.ts +8 -0
- package/dist/translations/fi.js +5 -0
- package/dist/translations/fi.umd.js +11 -0
- package/dist/translations/fr.d.ts +8 -0
- package/dist/translations/fr.js +5 -0
- package/dist/translations/fr.umd.js +11 -0
- package/dist/translations/gl.d.ts +8 -0
- package/dist/translations/gl.js +5 -0
- package/dist/translations/gl.umd.js +11 -0
- package/dist/translations/he.d.ts +8 -0
- package/dist/translations/he.js +5 -0
- package/dist/translations/he.umd.js +11 -0
- package/dist/translations/hi.d.ts +8 -0
- package/dist/translations/hi.js +5 -0
- package/dist/translations/hi.umd.js +11 -0
- package/dist/translations/hr.d.ts +8 -0
- package/dist/translations/hr.js +5 -0
- package/dist/translations/hr.umd.js +11 -0
- package/dist/translations/hu.d.ts +8 -0
- package/dist/translations/hu.js +5 -0
- package/dist/translations/hu.umd.js +11 -0
- package/dist/translations/hy.d.ts +8 -0
- package/dist/translations/hy.js +5 -0
- package/dist/translations/hy.umd.js +11 -0
- package/dist/translations/id.d.ts +8 -0
- package/dist/translations/id.js +5 -0
- package/dist/translations/id.umd.js +11 -0
- package/dist/translations/it.d.ts +8 -0
- package/dist/translations/it.js +5 -0
- package/dist/translations/it.umd.js +11 -0
- package/dist/translations/ja.d.ts +8 -0
- package/dist/translations/ja.js +5 -0
- package/dist/translations/ja.umd.js +11 -0
- package/dist/translations/jv.d.ts +8 -0
- package/dist/translations/jv.js +5 -0
- package/dist/translations/jv.umd.js +11 -0
- package/dist/translations/km.d.ts +8 -0
- package/dist/translations/km.js +5 -0
- package/dist/translations/km.umd.js +11 -0
- package/dist/translations/kn.d.ts +8 -0
- package/dist/translations/kn.js +5 -0
- package/dist/translations/kn.umd.js +11 -0
- package/dist/translations/ko.d.ts +8 -0
- package/dist/translations/ko.js +5 -0
- package/dist/translations/ko.umd.js +11 -0
- package/dist/translations/ku.d.ts +8 -0
- package/dist/translations/ku.js +5 -0
- package/dist/translations/ku.umd.js +11 -0
- package/dist/translations/lt.d.ts +8 -0
- package/dist/translations/lt.js +5 -0
- package/dist/translations/lt.umd.js +11 -0
- package/dist/translations/lv.d.ts +8 -0
- package/dist/translations/lv.js +5 -0
- package/dist/translations/lv.umd.js +11 -0
- package/dist/translations/ms.d.ts +8 -0
- package/dist/translations/ms.js +5 -0
- package/dist/translations/ms.umd.js +11 -0
- package/dist/translations/nb.d.ts +8 -0
- package/dist/translations/nb.js +5 -0
- package/dist/translations/nb.umd.js +11 -0
- package/dist/translations/ne.d.ts +8 -0
- package/dist/translations/ne.js +5 -0
- package/dist/translations/ne.umd.js +11 -0
- package/dist/translations/nl.d.ts +8 -0
- package/dist/translations/nl.js +5 -0
- package/dist/translations/nl.umd.js +11 -0
- package/dist/translations/no.d.ts +8 -0
- package/dist/translations/no.js +5 -0
- package/dist/translations/no.umd.js +11 -0
- package/dist/translations/pl.d.ts +8 -0
- package/dist/translations/pl.js +5 -0
- package/dist/translations/pl.umd.js +11 -0
- package/dist/translations/pt-br.d.ts +8 -0
- package/dist/translations/pt-br.js +5 -0
- package/dist/translations/pt-br.umd.js +11 -0
- package/dist/translations/pt.d.ts +8 -0
- package/dist/translations/pt.js +5 -0
- package/dist/translations/pt.umd.js +11 -0
- package/dist/translations/ro.d.ts +8 -0
- package/dist/translations/ro.js +5 -0
- package/dist/translations/ro.umd.js +11 -0
- package/dist/translations/ru.d.ts +8 -0
- package/dist/translations/ru.js +5 -0
- package/dist/translations/ru.umd.js +11 -0
- package/dist/translations/sk.d.ts +8 -0
- package/dist/translations/sk.js +5 -0
- package/dist/translations/sk.umd.js +11 -0
- package/dist/translations/sl.d.ts +8 -0
- package/dist/translations/sl.js +5 -0
- package/dist/translations/sl.umd.js +11 -0
- package/dist/translations/sq.d.ts +8 -0
- package/dist/translations/sq.js +5 -0
- package/dist/translations/sq.umd.js +11 -0
- package/dist/translations/sr-latn.d.ts +8 -0
- package/dist/translations/sr-latn.js +5 -0
- package/dist/translations/sr-latn.umd.js +11 -0
- package/dist/translations/sr.d.ts +8 -0
- package/dist/translations/sr.js +5 -0
- package/dist/translations/sr.umd.js +11 -0
- package/dist/translations/sv.d.ts +8 -0
- package/dist/translations/sv.js +5 -0
- package/dist/translations/sv.umd.js +11 -0
- package/dist/translations/th.d.ts +8 -0
- package/dist/translations/th.js +5 -0
- package/dist/translations/th.umd.js +11 -0
- package/dist/translations/ti.d.ts +8 -0
- package/dist/translations/ti.js +5 -0
- package/dist/translations/ti.umd.js +11 -0
- package/dist/translations/tk.d.ts +8 -0
- package/dist/translations/tk.js +5 -0
- package/dist/translations/tk.umd.js +11 -0
- package/dist/translations/tr.d.ts +8 -0
- package/dist/translations/tr.js +5 -0
- package/dist/translations/tr.umd.js +11 -0
- package/dist/translations/ug.d.ts +8 -0
- package/dist/translations/ug.js +5 -0
- package/dist/translations/ug.umd.js +11 -0
- package/dist/translations/uk.d.ts +8 -0
- package/dist/translations/uk.js +5 -0
- package/dist/translations/uk.umd.js +11 -0
- package/dist/translations/ur.d.ts +8 -0
- package/dist/translations/ur.js +5 -0
- package/dist/translations/ur.umd.js +11 -0
- package/dist/translations/uz.d.ts +8 -0
- package/dist/translations/uz.js +5 -0
- package/dist/translations/uz.umd.js +11 -0
- package/dist/translations/vi.d.ts +8 -0
- package/dist/translations/vi.js +5 -0
- package/dist/translations/vi.umd.js +11 -0
- package/dist/translations/zh-cn.d.ts +8 -0
- package/dist/translations/zh-cn.js +5 -0
- package/dist/translations/zh-cn.umd.js +11 -0
- package/dist/translations/zh.d.ts +8 -0
- package/dist/translations/zh.js +5 -0
- package/dist/translations/zh.umd.js +11 -0
- package/dist/utils.d.ts +22 -0
- package/lang/contexts.json +13 -0
- package/lang/translations/ar.po +62 -0
- package/lang/translations/az.po +62 -0
- package/lang/translations/bg.po +62 -0
- package/lang/translations/bn.po +62 -0
- package/lang/translations/bs.po +62 -0
- package/lang/translations/ca.po +62 -0
- package/lang/translations/cs.po +62 -0
- package/lang/translations/da.po +62 -0
- package/lang/translations/de-ch.po +62 -0
- package/lang/translations/de.po +62 -0
- package/lang/translations/el.po +62 -0
- package/lang/translations/en-au.po +62 -0
- package/lang/translations/en-gb.po +62 -0
- package/lang/translations/en.po +62 -0
- package/lang/translations/eo.po +62 -0
- package/lang/translations/es.po +62 -0
- package/lang/translations/et.po +62 -0
- package/lang/translations/eu.po +62 -0
- package/lang/translations/fa.po +62 -0
- package/lang/translations/fi.po +62 -0
- package/lang/translations/fr.po +62 -0
- package/lang/translations/gl.po +62 -0
- package/lang/translations/he.po +62 -0
- package/lang/translations/hi.po +62 -0
- package/lang/translations/hr.po +62 -0
- package/lang/translations/hu.po +62 -0
- package/lang/translations/hy.po +62 -0
- package/lang/translations/id.po +62 -0
- package/lang/translations/it.po +62 -0
- package/lang/translations/ja.po +62 -0
- package/lang/translations/jv.po +62 -0
- package/lang/translations/km.po +62 -0
- package/lang/translations/kn.po +62 -0
- package/lang/translations/ko.po +62 -0
- package/lang/translations/ku.po +62 -0
- package/lang/translations/lt.po +62 -0
- package/lang/translations/lv.po +62 -0
- package/lang/translations/ms.po +62 -0
- package/lang/translations/nb.po +62 -0
- package/lang/translations/ne.po +62 -0
- package/lang/translations/nl.po +62 -0
- package/lang/translations/no.po +62 -0
- package/lang/translations/pl.po +62 -0
- package/lang/translations/pt-br.po +62 -0
- package/lang/translations/pt.po +62 -0
- package/lang/translations/ro.po +62 -0
- package/lang/translations/ru.po +62 -0
- package/lang/translations/sk.po +62 -0
- package/lang/translations/sl.po +62 -0
- package/lang/translations/sq.po +62 -0
- package/lang/translations/sr-latn.po +62 -0
- package/lang/translations/sr.po +62 -0
- package/lang/translations/sv.po +62 -0
- package/lang/translations/th.po +62 -0
- package/lang/translations/ti.po +62 -0
- package/lang/translations/tk.po +62 -0
- package/lang/translations/tr.po +62 -0
- package/lang/translations/ug.po +62 -0
- package/lang/translations/uk.po +62 -0
- package/lang/translations/ur.po +62 -0
- package/lang/translations/uz.po +62 -0
- package/lang/translations/vi.po +62 -0
- package/lang/translations/zh-cn.po +62 -0
- package/lang/translations/zh.po +62 -0
- package/package.json +43 -0
- package/src/augmentation.d.ts +30 -0
- package/src/augmentation.js +5 -0
- package/src/heading.d.ts +36 -0
- package/src/heading.js +42 -0
- package/src/headingbuttonsui.d.ts +51 -0
- package/src/headingbuttonsui.js +83 -0
- package/src/headingcommand.d.ts +48 -0
- package/src/headingcommand.js +65 -0
- package/src/headingconfig.d.ts +119 -0
- package/src/headingconfig.js +5 -0
- package/src/headingediting.d.ts +46 -0
- package/src/headingediting.js +107 -0
- package/src/headingui.d.ts +26 -0
- package/src/headingui.js +171 -0
- package/src/index.d.ts +16 -0
- package/src/index.js +13 -0
- package/src/title.d.ts +119 -0
- package/src/title.js +466 -0
- package/src/utils.d.ts +18 -0
- package/src/utils.js +31 -0
- package/theme/heading.css +20 -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 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,123 @@
|
|
|
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;
|
|
76
|
+
export interface HeadingElementOption {
|
|
77
|
+
/**
|
|
78
|
+
* Name of the model element to convert.
|
|
79
|
+
*/
|
|
80
|
+
model: 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6' | `heading${string}` & Record<never, never>;
|
|
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 HeadingParagraphOption {
|
|
103
|
+
/**
|
|
104
|
+
* Name of the model element to convert.
|
|
105
|
+
*/
|
|
106
|
+
model: 'paragraph';
|
|
107
|
+
/**
|
|
108
|
+
* The user-readable title of the option.
|
|
109
|
+
*/
|
|
110
|
+
title: string;
|
|
111
|
+
/**
|
|
112
|
+
* The class which will be added to the dropdown item representing this option.
|
|
113
|
+
* */
|
|
114
|
+
class: string;
|
|
115
|
+
/**
|
|
116
|
+
* Icon used by {@link module:heading/headingbuttonsui~HeadingButtonsUI}. It can be omitted when using the default configuration.
|
|
117
|
+
*/
|
|
118
|
+
icon?: string;
|
|
119
|
+
/**
|
|
120
|
+
* An array with all matched elements that the view-to-model conversion should also accept.
|
|
121
|
+
*/
|
|
122
|
+
upcastAlso?: ArrayOrItem<ViewElementDefinition | MatcherPattern>;
|
|
123
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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 – 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
|
+
static get isOfficialPlugin(): true;
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
constructor(editor: Editor);
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
static get requires(): readonly [typeof Paragraph];
|
|
36
|
+
/**
|
|
37
|
+
* @inheritDoc
|
|
38
|
+
*/
|
|
39
|
+
init(): void;
|
|
40
|
+
/**
|
|
41
|
+
* @inheritDoc
|
|
42
|
+
*/
|
|
43
|
+
afterInit(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Adds default conversion for `h1` -> `heading1` with a low priority.
|
|
46
|
+
*
|
|
47
|
+
* @param editor Editor instance on which to add the `h1` conversion.
|
|
48
|
+
*/
|
|
49
|
+
private _addDefaultH1Conversion;
|
|
50
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
static get isOfficialPlugin(): true;
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
init(): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
.ck.ck-heading_heading1 .ck-button__label{
|
|
6
|
+
font-size:20px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.ck.ck-heading_heading2 .ck-button__label{
|
|
10
|
+
font-size:17px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ck.ck-heading_heading3 .ck-button__label{
|
|
14
|
+
font-size:14px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ck[class*="ck-heading_heading"]{
|
|
18
|
+
font-weight:bold;
|
|
19
|
+
}
|
package/dist/index.css
ADDED
|
@@ -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
|
+
* 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
|
+
.ck.ck-heading_heading1 .ck-button__label {
|
|
11
|
+
font-size: 20px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ck.ck-heading_heading2 .ck-button__label {
|
|
15
|
+
font-size: 17px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ck.ck-heading_heading3 .ck-button__label {
|
|
19
|
+
font-size: 14px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ck[class*="ck-heading_heading"] {
|
|
23
|
+
font-weight: bold;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/*# sourceMappingURL=index.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../theme/heading.css","index.css"],"names":[],"mappings":";;;;AAAA,CAAA;ACCA,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ;AAC3E,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;AAC5E,CAAC,CDAC;;AAEF,CAAA,EAAA,CAAA,EAAA,CAAA,gBAAA,CAAA,CAAA,EAAA,CAAA,aAAA,CAAA;ACCA,CDAC,IAAA,CAAA,IAAA,CAAA,CAAA,IAAe;AAChB;;AAEA,CAAA,EAAA,CAAA,EAAA,CAAA,gBAAA,CAAA,CAAA,EAAA,CAAA,aAAA,CAAA;ACCA,CDAC,IAAA,CAAA,IAAA,CAAA,CAAA,IAAe;AAChB;;AAEA,CAAA,EAAA,CAAA,EAAA,CAAA,gBAAA,CAAA,CAAA,EAAA,CAAA,aAAA,CAAA;ACCA,CDAC,IAAA,CAAA,IAAA,CAAA,CAAA,IAAe;AAChB;;AAEA,CAAA,EAAA,CAAA,KAAA,CAAA,CAAA,CAAA,EAAA,CAAA,eAAA,CAAA,CAAA,CAAA;ACCA,CDAC,IAAA,CAAA,MAAA,CAAA,CAAA,IAAiB;AAClB;;ACEA,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","file":"index.css.map","sourcesContent":["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-heading_heading1 .ck-button__label {\n\tfont-size: 20px;\n}\n\n.ck.ck-heading_heading2 .ck-button__label {\n\tfont-size: 17px;\n}\n\n.ck.ck-heading_heading3 .ck-button__label {\n\tfont-size: 14px;\n}\n\n.ck[class*=\"ck-heading_heading\"] {\n\tfont-weight: bold;\n}\n","/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-heading_heading1 .ck-button__label {\n\tfont-size: 20px;\n}\n\n.ck.ck-heading_heading2 .ck-button__label {\n\tfont-size: 17px;\n}\n\n.ck.ck-heading_heading3 .ck-button__label {\n\tfont-size: 14px;\n}\n\n.ck[class*=\"ck-heading_heading\"] {\n\tfont-weight: bold;\n}\n\n/*# sourceMappingURL=index.css.map */"]}
|
package/dist/index.d.ts
ADDED
|
@@ -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';
|