@ckeditor/ckeditor5-heading 36.0.1 → 37.0.0-alpha.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-heading",
3
- "version": "36.0.1",
3
+ "version": "37.0.0-alpha.1",
4
4
  "description": "Headings feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,26 +12,26 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "ckeditor5": "^36.0.1"
15
+ "ckeditor5": "^37.0.0-alpha.1"
16
16
  },
17
17
  "devDependencies": {
18
- "@ckeditor/ckeditor5-alignment": "^36.0.1",
19
- "@ckeditor/ckeditor5-basic-styles": "^36.0.1",
20
- "@ckeditor/ckeditor5-block-quote": "^36.0.1",
21
- "@ckeditor/ckeditor5-core": "^36.0.1",
22
- "@ckeditor/ckeditor5-clipboard": "^36.0.1",
23
- "@ckeditor/ckeditor5-dev-utils": "^32.0.0",
24
- "@ckeditor/ckeditor5-editor-classic": "^36.0.1",
25
- "@ckeditor/ckeditor5-engine": "^36.0.1",
26
- "@ckeditor/ckeditor5-enter": "^36.0.1",
27
- "@ckeditor/ckeditor5-image": "^36.0.1",
28
- "@ckeditor/ckeditor5-paragraph": "^36.0.1",
29
- "@ckeditor/ckeditor5-theme-lark": "^36.0.1",
30
- "@ckeditor/ckeditor5-typing": "^36.0.1",
31
- "@ckeditor/ckeditor5-ui": "^36.0.1",
32
- "@ckeditor/ckeditor5-undo": "^36.0.1",
33
- "@ckeditor/ckeditor5-upload": "^36.0.1",
34
- "@ckeditor/ckeditor5-utils": "^36.0.1",
18
+ "@ckeditor/ckeditor5-alignment": "^37.0.0-alpha.1",
19
+ "@ckeditor/ckeditor5-basic-styles": "^37.0.0-alpha.1",
20
+ "@ckeditor/ckeditor5-block-quote": "^37.0.0-alpha.1",
21
+ "@ckeditor/ckeditor5-core": "^37.0.0-alpha.1",
22
+ "@ckeditor/ckeditor5-clipboard": "^37.0.0-alpha.1",
23
+ "@ckeditor/ckeditor5-dev-utils": "^35.0.0",
24
+ "@ckeditor/ckeditor5-editor-classic": "^37.0.0-alpha.1",
25
+ "@ckeditor/ckeditor5-engine": "^37.0.0-alpha.1",
26
+ "@ckeditor/ckeditor5-enter": "^37.0.0-alpha.1",
27
+ "@ckeditor/ckeditor5-image": "^37.0.0-alpha.1",
28
+ "@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.1",
29
+ "@ckeditor/ckeditor5-theme-lark": "^37.0.0-alpha.1",
30
+ "@ckeditor/ckeditor5-typing": "^37.0.0-alpha.1",
31
+ "@ckeditor/ckeditor5-ui": "^37.0.0-alpha.1",
32
+ "@ckeditor/ckeditor5-undo": "^37.0.0-alpha.1",
33
+ "@ckeditor/ckeditor5-upload": "^37.0.0-alpha.1",
34
+ "@ckeditor/ckeditor5-utils": "^37.0.0-alpha.1",
35
35
  "typescript": "^4.8.4",
36
36
  "webpack": "^5.58.1",
37
37
  "webpack-cli": "^4.9.0"
@@ -60,7 +60,8 @@
60
60
  ],
61
61
  "scripts": {
62
62
  "dll:build": "webpack",
63
- "build": "tsc -p ./tsconfig.release.json",
63
+ "build": "tsc -p ./tsconfig.json",
64
64
  "postversion": "npm run build"
65
- }
65
+ },
66
+ "types": "src/index.d.ts"
66
67
  }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ import type { Heading, HeadingCommand, HeadingConfig, HeadingEditing, HeadingUI, Title, TitleConfig } from './index';
6
+ declare module '@ckeditor/ckeditor5-core' {
7
+ interface EditorConfig {
8
+ /**
9
+ * The configuration of the heading feature. Introduced by the {@link module:heading/headingediting~HeadingEditing} feature.
10
+ *
11
+ * Read more in {@link module:heading/headingconfig~HeadingConfig}.
12
+ */
13
+ heading?: HeadingConfig;
14
+ /**
15
+ * The configuration of the {@link module:heading/title~Title title feature}.
16
+ *
17
+ * Read more in {@link module:heading/title~TitleConfig}.
18
+ */
19
+ title?: TitleConfig;
20
+ }
21
+ interface PluginsMap {
22
+ [Heading.pluginName]: Heading;
23
+ [HeadingEditing.pluginName]: HeadingEditing;
24
+ [HeadingUI.pluginName]: HeadingUI;
25
+ [Title.pluginName]: Title;
26
+ }
27
+ interface CommandsMap {
28
+ heading: HeadingCommand;
29
+ }
30
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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 {};
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module heading/heading
7
+ */
8
+ import { Plugin, type PluginDependencies } from 'ckeditor5/src/core';
9
+ import '../theme/heading.css';
10
+ /**
11
+ * The headings feature.
12
+ *
13
+ * For a detailed overview, check the {@glink features/headings Headings feature} guide
14
+ * and the {@glink api/heading package page}.
15
+ *
16
+ * This is a "glue" plugin which loads the {@link module:heading/headingediting~HeadingEditing heading editing feature}
17
+ * and {@link module:heading/headingui~HeadingUI heading UI feature}.
18
+ *
19
+ * @extends module:core/plugin~Plugin
20
+ */
21
+ export default class Heading extends Plugin {
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get requires(): PluginDependencies;
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get pluginName(): 'Heading';
30
+ }
package/src/heading.js CHANGED
@@ -12,7 +12,7 @@ import '../theme/heading.css';
12
12
  /**
13
13
  * The headings feature.
14
14
  *
15
- * For a detailed overview, check the {@glink features/headings Headings feature documentation}
15
+ * For a detailed overview, check the {@glink features/headings Headings feature} guide
16
16
  * and the {@glink api/heading package page}.
17
17
  *
18
18
  * This is a "glue" plugin which loads the {@link module:heading/headingediting~HeadingEditing heading editing feature}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module heading/headingbuttonsui
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ /**
10
+ * The `HeadingButtonsUI` plugin defines a set of UI buttons that can be used instead of the
11
+ * standard drop down component.
12
+ *
13
+ * This feature is not enabled by default by the {@link module:heading/heading~Heading} plugin and needs to be
14
+ * installed manually to the editor configuration.
15
+ *
16
+ * Plugin introduces button UI elements, which names are same as `model` property from {@link module:heading/headingconfig~HeadingOption}.
17
+ *
18
+ * ```ts
19
+ * ClassicEditor
20
+ * .create( {
21
+ * plugins: [ ..., Heading, Paragraph, HeadingButtonsUI, ParagraphButtonUI ]
22
+ * heading: {
23
+ * options: [
24
+ * { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
25
+ * { model: 'heading1', view: 'h2', title: 'Heading 1', class: 'ck-heading_heading1' },
26
+ * { model: 'heading2', view: 'h3', title: 'Heading 2', class: 'ck-heading_heading2' },
27
+ * { model: 'heading3', view: 'h4', title: 'Heading 3', class: 'ck-heading_heading3' }
28
+ * ]
29
+ * },
30
+ * toolbar: [ 'paragraph', 'heading1', 'heading2', 'heading3' ]
31
+ * } )
32
+ * .then( ... )
33
+ * .catch( ... );
34
+ * ```
35
+ *
36
+ * NOTE: The `'paragraph'` button is defined in by the {@link module:paragraph/paragraphbuttonui~ParagraphButtonUI} plugin
37
+ * which needs to be loaded manually as well.
38
+ *
39
+ * It is possible to use custom icons by providing `icon` config option in {@link module:heading/headingconfig~HeadingOption}.
40
+ * For the default configuration standard icons are used.
41
+ */
42
+ export default class HeadingButtonsUI extends Plugin {
43
+ /**
44
+ * @inheritDoc
45
+ */
46
+ init(): void;
47
+ /**
48
+ * Creates single button view from provided configuration option.
49
+ */
50
+ private _createButton;
51
+ }
@@ -29,7 +29,7 @@ const defaultIcons = {
29
29
  * This feature is not enabled by default by the {@link module:heading/heading~Heading} plugin and needs to be
30
30
  * installed manually to the editor configuration.
31
31
  *
32
- * Plugin introduces button UI elements, which names are same as `model` property from {@link module:heading/heading~HeadingOption}.
32
+ * Plugin introduces button UI elements, which names are same as `model` property from {@link module:heading/headingconfig~HeadingOption}.
33
33
  *
34
34
  * ```ts
35
35
  * ClassicEditor
@@ -52,7 +52,7 @@ const defaultIcons = {
52
52
  * NOTE: The `'paragraph'` button is defined in by the {@link module:paragraph/paragraphbuttonui~ParagraphButtonUI} plugin
53
53
  * which needs to be loaded manually as well.
54
54
  *
55
- * It is possible to use custom icons by providing `icon` config option in {@link module:heading/heading~HeadingOption}.
55
+ * It is possible to use custom icons by providing `icon` config option in {@link module:heading/headingconfig~HeadingOption}.
56
56
  * For the default configuration standard icons are used.
57
57
  */
58
58
  export default class HeadingButtonsUI extends Plugin {
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module heading/headingcommand
7
+ */
8
+ import { Command, type Editor } from 'ckeditor5/src/core';
9
+ /**
10
+ * The heading command. It is used by the {@link module:heading/heading~Heading heading feature} to apply headings.
11
+ */
12
+ export default class HeadingCommand extends Command {
13
+ /**
14
+ * If the selection starts in a heading (which {@link #modelElements is supported by this command})
15
+ * the value is set to the name of that heading model element.
16
+ * It is set to `false` otherwise.
17
+ *
18
+ * @observable
19
+ * @readonly
20
+ */
21
+ value: false | string;
22
+ /**
23
+ * Set of defined model's elements names that this command support.
24
+ * See {@link module:heading/headingconfig~HeadingOption}.
25
+ */
26
+ readonly modelElements: Array<string>;
27
+ /**
28
+ * Creates an instance of the command.
29
+ *
30
+ * @param editor Editor instance.
31
+ * @param modelElements Names of the element which this command can apply in the model.
32
+ */
33
+ constructor(editor: Editor, modelElements: Array<string>);
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ refresh(): void;
38
+ /**
39
+ * Executes the command. Applies the heading to the selected blocks or, if the first selected
40
+ * block is a heading already, turns selected headings (of this level only) to paragraphs.
41
+ *
42
+ * @param options.value Name of the element which this command will apply in the model.
43
+ * @fires execute
44
+ */
45
+ execute(options: {
46
+ value: string;
47
+ }): void;
48
+ }
@@ -0,0 +1,110 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module heading/headingconfig
7
+ */
8
+ import type { ViewElementDefinition } from 'ckeditor5/src/engine';
9
+ /**
10
+ * The configuration of the heading feature.
11
+ * The option is used by the {@link module:heading/headingediting~HeadingEditing} feature.
12
+ *
13
+ * ```ts
14
+ * ClassicEditor
15
+ * .create( {
16
+ * heading: ... // Heading feature config.
17
+ * } )
18
+ * .then( ... )
19
+ * .catch( ... );
20
+ * ```
21
+ *
22
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
23
+ */
24
+ export interface HeadingConfig {
25
+ /**
26
+ * The available heading options.
27
+ *
28
+ * The default value is:
29
+ * ```ts
30
+ * const headingConfig = {
31
+ * options: [
32
+ * { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
33
+ * { model: 'heading1', view: 'h2', title: 'Heading 1', class: 'ck-heading_heading1' },
34
+ * { model: 'heading2', view: 'h3', title: 'Heading 2', class: 'ck-heading_heading2' },
35
+ * { model: 'heading3', view: 'h4', title: 'Heading 3', class: 'ck-heading_heading3' }
36
+ * ]
37
+ * };
38
+ * ```
39
+ *
40
+ * It defines 3 levels of headings. In the editor model they will use `heading1`, `heading2`, and `heading3` elements.
41
+ * Their respective view elements (so the elements output by the editor) will be: `h2`, `h3`, and `h4`. This means that
42
+ * if you choose "Heading 1" in the headings dropdown the editor will turn the current block to `<heading1>` in the model
43
+ * which will result in rendering (and outputting to data) the `<h2>` element.
44
+ *
45
+ * The `title` and `class` properties will be used by the `headings` dropdown to render available options.
46
+ * Usually, the first option in the headings dropdown is the "Paragraph" option, hence it's also defined on the list.
47
+ * However, you don't need to define its view representation because it's handled by
48
+ * the {@link module:paragraph/paragraph~Paragraph} feature (which is required by
49
+ * the {@link module:heading/headingediting~HeadingEditing} feature).
50
+ *
51
+ * You can **read more** about configuring heading levels and **see more examples** in
52
+ * the {@glink features/headings Headings} guide.
53
+ *
54
+ * Note: In the model you should always start from `heading1`, regardless of how the headings are represented in the view.
55
+ * That's assumption is used by features like {@link module:autoformat/autoformat~Autoformat} to know which element
56
+ * they should use when applying the first level heading.
57
+ *
58
+ * The defined headings are also available as values passed to the `'heading'` command under their model names.
59
+ * For example, the below code will apply `<heading1>` to the current selection:
60
+ *
61
+ * ```ts
62
+ * editor.execute( 'heading', { value: 'heading1' } );
63
+ * ```
64
+ */
65
+ options?: Array<HeadingOption>;
66
+ }
67
+ /**
68
+ * Heading option descriptor.
69
+ */
70
+ export type HeadingOption = HeadingElementOption | HeadingParagraphOption;
71
+ export interface HeadingElementOption {
72
+ /**
73
+ * Name of the model element to convert.
74
+ */
75
+ model: 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6';
76
+ /**
77
+ * Definition of a view element to convert from/to.
78
+ */
79
+ view: ViewElementDefinition;
80
+ /**
81
+ * The user-readable title of the option.
82
+ */
83
+ title: string;
84
+ /**
85
+ * The class which will be added to the dropdown item representing this option.
86
+ */
87
+ class: string;
88
+ /**
89
+ * Icon used by {@link module:heading/headingbuttonsui~HeadingButtonsUI}. It can be omitted when using the default configuration.
90
+ */
91
+ icon?: string;
92
+ }
93
+ export interface HeadingParagraphOption {
94
+ /**
95
+ * Name of the model element to convert.
96
+ */
97
+ model: 'paragraph';
98
+ /**
99
+ * The user-readable title of the option.
100
+ */
101
+ title: string;
102
+ /**
103
+ * The class which will be added to the dropdown item representing this option.
104
+ * */
105
+ class: string;
106
+ /**
107
+ * Icon used by {@link module:heading/headingbuttonsui~HeadingButtonsUI}. It can be omitted when using the default configuration.
108
+ */
109
+ icon?: string;
110
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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 {};
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module heading/headingediting
7
+ */
8
+ import { Plugin, type Editor, type PluginDependencies } from 'ckeditor5/src/core';
9
+ /**
10
+ * The headings engine feature. It handles switching between block formats &ndash; headings and paragraph.
11
+ * This class represents the engine part of the heading feature. See also {@link module:heading/heading~Heading}.
12
+ * It introduces `heading1`-`headingN` commands which allow to convert paragraphs into headings.
13
+ */
14
+ export default class HeadingEditing extends Plugin {
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ static get pluginName(): 'HeadingEditing';
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ constructor(editor: Editor);
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get requires(): PluginDependencies;
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ init(): void;
31
+ /**
32
+ * @inheritDoc
33
+ */
34
+ afterInit(): void;
35
+ /**
36
+ * Adds default conversion for `h1` -> `heading1` with a low priority.
37
+ *
38
+ * @param editor Editor instance on which to add the `h1` conversion.
39
+ */
40
+ private _addDefaultH1Conversion;
41
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module heading/headingui
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import '../theme/heading.css';
10
+ /**
11
+ * The headings UI feature. It introduces the `headings` dropdown.
12
+ */
13
+ export default class HeadingUI extends Plugin {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get pluginName(): 'HeadingUI';
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ init(): void;
22
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module heading
7
+ */
8
+ export { default as Heading } from './heading';
9
+ export type { HeadingOption } from './headingconfig';
10
+ export { default as HeadingEditing } from './headingediting';
11
+ export { default as HeadingUI } from './headingui';
12
+ export { default as HeadingButtonsUI } from './headingbuttonsui';
13
+ export { default as Title, type TitleConfig } from './title';
14
+ export type { HeadingConfig } from './headingconfig';
15
+ export type { default as HeadingCommand } from './headingcommand';
16
+ import './augmentation';
package/src/index.js CHANGED
@@ -10,3 +10,4 @@ export { default as HeadingEditing } from './headingediting';
10
10
  export { default as HeadingUI } from './headingui';
11
11
  export { default as HeadingButtonsUI } from './headingbuttonsui';
12
12
  export { default as Title } from './title';
13
+ import './augmentation';
package/src/title.d.ts ADDED
@@ -0,0 +1,115 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module heading/title
7
+ */
8
+ import { Plugin, type PluginDependencies } from 'ckeditor5/src/core';
9
+ /**
10
+ * The Title plugin.
11
+ *
12
+ * It splits the document into `Title` and `Body` sections.
13
+ */
14
+ export default class Title extends Plugin {
15
+ /**
16
+ * A reference to an empty paragraph in the body
17
+ * created when there is no element in the body for the placeholder purposes.
18
+ */
19
+ private _bodyPlaceholder?;
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get pluginName(): 'Title';
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ static get requires(): PluginDependencies;
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ init(): void;
32
+ /**
33
+ * Returns the title of the document. Note that because this plugin does not allow any formatting inside
34
+ * the title element, the output of this method will be a plain text, with no HTML tags.
35
+ *
36
+ * It is not recommended to use this method together with features that insert markers to the
37
+ * data output, like comments or track changes features. If such markers start in the title and end in the
38
+ * body, the result of this method might be incorrect.
39
+ *
40
+ * @param options Additional configuration passed to the conversion process.
41
+ * See {@link module:engine/controller/datacontroller~DataController#get `DataController#get`}.
42
+ * @returns The title of the document.
43
+ */
44
+ getTitle(options?: Record<string, unknown>): string;
45
+ /**
46
+ * Returns the body of the document.
47
+ *
48
+ * Note that it is not recommended to use this method together with features that insert markers to the
49
+ * data output, like comments or track changes features. If such markers start in the title and end in the
50
+ * body, the result of this method might be incorrect.
51
+ *
52
+ * @param options Additional configuration passed to the conversion process.
53
+ * See {@link module:engine/controller/datacontroller~DataController#get `DataController#get`}.
54
+ * @returns The body of the document.
55
+ */
56
+ getBody(options?: Record<string, unknown>): string;
57
+ /**
58
+ * Returns the `title` element when it is in the document. Returns `undefined` otherwise.
59
+ */
60
+ private _getTitleElement;
61
+ /**
62
+ * Model post-fixer callback that ensures that `title` has only one `title-content` child.
63
+ * All additional children should be moved after the `title` element and renamed to a paragraph.
64
+ */
65
+ private _fixTitleContent;
66
+ /**
67
+ * Model post-fixer callback that creates a title element when it is missing,
68
+ * takes care of the correct position of it and removes additional title elements.
69
+ */
70
+ private _fixTitleElement;
71
+ /**
72
+ * Model post-fixer callback that adds an empty paragraph at the end of the document
73
+ * when it is needed for the placeholder purposes.
74
+ */
75
+ private _fixBodyElement;
76
+ /**
77
+ * Model post-fixer callback that removes a paragraph from the end of the document
78
+ * if it was created for the placeholder purposes and is not needed anymore.
79
+ */
80
+ private _fixExtraParagraph;
81
+ /**
82
+ * Attaches the `Title` and `Body` placeholders to the title and/or content.
83
+ */
84
+ private _attachPlaceholders;
85
+ /**
86
+ * Creates navigation between the title and body sections using <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.
87
+ */
88
+ private _attachTabPressHandling;
89
+ }
90
+ /**
91
+ * The configuration of the {@link module:heading/title~Title title feature}.
92
+ *
93
+ * ```ts
94
+ * ClassicEditor
95
+ * .create( document.querySelector( '#editor' ), {
96
+ * plugins: [ Title, ... ],
97
+ * title: {
98
+ * placeholder: 'My custom placeholder for the title'
99
+ * },
100
+ * placeholder: 'My custom placeholder for the body'
101
+ * } )
102
+ * .then( ... )
103
+ * .catch( ... );
104
+ * ```
105
+ *
106
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.
107
+ */
108
+ export interface TitleConfig {
109
+ /**
110
+ * Defines a custom value of the placeholder for the title field.
111
+ *
112
+ * Read more in {@link module:heading/title~TitleConfig}.
113
+ */
114
+ placeholder?: string;
115
+ }
package/src/utils.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module heading/utils
7
+ */
8
+ import type { Editor } from 'ckeditor5/src/core';
9
+ import type { HeadingOption } from './headingconfig';
10
+ /**
11
+ * Returns heading options as defined in `config.heading.options` but processed to consider
12
+ * the editor localization, i.e. to display {@link module:heading/headingconfig~HeadingOption}
13
+ * in the correct language.
14
+ *
15
+ * Note: The reason behind this method is that there is no way to use {@link module:utils/locale~Locale#t}
16
+ * when the user configuration is defined because the editor does not exist yet.
17
+ */
18
+ export declare function getLocalizedOptions(editor: Editor): Array<HeadingOption>;
package/src/utils.js CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
  /**
6
6
  * Returns heading options as defined in `config.heading.options` but processed to consider
7
- * the editor localization, i.e. to display {@link module:heading/heading~HeadingOption}
7
+ * the editor localization, i.e. to display {@link module:heading/headingconfig~HeadingOption}
8
8
  * in the correct language.
9
9
  *
10
10
  * Note: The reason behind this method is that there is no way to use {@link module:utils/locale~Locale#t}