@ckeditor/ckeditor5-heading 45.2.1-alpha.9 → 46.0.0-alpha.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-heading",
3
- "version": "45.2.1-alpha.9",
3
+ "version": "46.0.0-alpha.0",
4
4
  "description": "Headings feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,13 +13,13 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "@ckeditor/ckeditor5-core": "45.2.1-alpha.9",
17
- "@ckeditor/ckeditor5-engine": "45.2.1-alpha.9",
18
- "@ckeditor/ckeditor5-icons": "45.2.1-alpha.9",
19
- "@ckeditor/ckeditor5-paragraph": "45.2.1-alpha.9",
20
- "@ckeditor/ckeditor5-ui": "45.2.1-alpha.9",
21
- "@ckeditor/ckeditor5-utils": "45.2.1-alpha.9",
22
- "ckeditor5": "45.2.1-alpha.9"
16
+ "@ckeditor/ckeditor5-core": "46.0.0-alpha.0",
17
+ "@ckeditor/ckeditor5-engine": "46.0.0-alpha.0",
18
+ "@ckeditor/ckeditor5-icons": "46.0.0-alpha.0",
19
+ "@ckeditor/ckeditor5-paragraph": "46.0.0-alpha.0",
20
+ "@ckeditor/ckeditor5-ui": "46.0.0-alpha.0",
21
+ "@ckeditor/ckeditor5-utils": "46.0.0-alpha.0",
22
+ "ckeditor5": "46.0.0-alpha.0"
23
23
  },
24
24
  "author": "CKSource (http://cksource.com/)",
25
25
  "license": "SEE LICENSE IN LICENSE.md",
@@ -2,7 +2,7 @@
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
- import type { Heading, HeadingCommand, HeadingConfig, HeadingEditing, HeadingUI, Title, TitleConfig } from './index.js';
5
+ import type { Heading, HeadingCommand, HeadingConfig, HeadingEditing, HeadingTitleConfig, HeadingUI, Title } from './index.js';
6
6
  declare module '@ckeditor/ckeditor5-core' {
7
7
  interface EditorConfig {
8
8
  /**
@@ -14,9 +14,9 @@ declare module '@ckeditor/ckeditor5-core' {
14
14
  /**
15
15
  * The configuration of the {@link module:heading/title~Title title feature}.
16
16
  *
17
- * Read more in {@link module:heading/title~TitleConfig}.
17
+ * Read more in {@link module:heading/title~HeadingTitleConfig}.
18
18
  */
19
- title?: TitleConfig;
19
+ title?: HeadingTitleConfig;
20
20
  }
21
21
  interface PluginsMap {
22
22
  [Heading.pluginName]: Heading;
package/src/heading.d.ts CHANGED
@@ -6,8 +6,8 @@
6
6
  * @module heading/heading
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
- import HeadingEditing from './headingediting.js';
10
- import HeadingUI from './headingui.js';
9
+ import { HeadingEditing } from './headingediting.js';
10
+ import { HeadingUI } from './headingui.js';
11
11
  import '../theme/heading.css';
12
12
  /**
13
13
  * The headings feature.
@@ -20,7 +20,7 @@ import '../theme/heading.css';
20
20
  *
21
21
  * @extends module:core/plugin~Plugin
22
22
  */
23
- export default class Heading extends Plugin {
23
+ export declare class Heading extends Plugin {
24
24
  /**
25
25
  * @inheritDoc
26
26
  */
package/src/heading.js CHANGED
@@ -6,8 +6,8 @@
6
6
  * @module heading/heading
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
- import HeadingEditing from './headingediting.js';
10
- import HeadingUI from './headingui.js';
9
+ import { HeadingEditing } from './headingediting.js';
10
+ import { HeadingUI } from './headingui.js';
11
11
  import '../theme/heading.css';
12
12
  /**
13
13
  * The headings feature.
@@ -20,7 +20,7 @@ import '../theme/heading.css';
20
20
  *
21
21
  * @extends module:core/plugin~Plugin
22
22
  */
23
- export default class Heading extends Plugin {
23
+ export class Heading extends Plugin {
24
24
  /**
25
25
  * @inheritDoc
26
26
  */
@@ -39,7 +39,7 @@ import { Plugin } from 'ckeditor5/src/core.js';
39
39
  * It is possible to use custom icons by providing `icon` config option in {@link module:heading/headingconfig~HeadingOption}.
40
40
  * For the default configuration standard icons are used.
41
41
  */
42
- export default class HeadingButtonsUI extends Plugin {
42
+ export declare class HeadingButtonsUI extends Plugin {
43
43
  /**
44
44
  * @inheritDoc
45
45
  */
@@ -50,7 +50,7 @@ const defaultIcons = /* #__PURE__ */ (() => ({
50
50
  * It is possible to use custom icons by providing `icon` config option in {@link module:heading/headingconfig~HeadingOption}.
51
51
  * For the default configuration standard icons are used.
52
52
  */
53
- export default class HeadingButtonsUI extends Plugin {
53
+ export class HeadingButtonsUI extends Plugin {
54
54
  /**
55
55
  * @inheritDoc
56
56
  */
@@ -9,7 +9,7 @@ import { Command, type Editor } from 'ckeditor5/src/core.js';
9
9
  /**
10
10
  * The heading command. It is used by the {@link module:heading/heading~Heading heading feature} to apply headings.
11
11
  */
12
- export default class HeadingCommand extends Command {
12
+ export declare class HeadingCommand extends Command {
13
13
  /**
14
14
  * If the selection starts in a heading (which {@link #modelElements is supported by this command})
15
15
  * the value is set to the name of that heading model element.
@@ -10,7 +10,7 @@ import { first } from 'ckeditor5/src/utils.js';
10
10
  /**
11
11
  * The heading command. It is used by the {@link module:heading/heading~Heading heading feature} to apply headings.
12
12
  */
13
- export default class HeadingCommand extends Command {
13
+ export class HeadingCommand extends Command {
14
14
  /**
15
15
  * Set of defined model's elements names that this command support.
16
16
  * See {@link module:heading/headingconfig~HeadingOption}.
@@ -12,7 +12,7 @@ import { Paragraph } from 'ckeditor5/src/paragraph.js';
12
12
  * This class represents the engine part of the heading feature. See also {@link module:heading/heading~Heading}.
13
13
  * It introduces `heading1`-`headingN` commands which allow to convert paragraphs into headings.
14
14
  */
15
- export default class HeadingEditing extends Plugin {
15
+ export declare class HeadingEditing extends Plugin {
16
16
  /**
17
17
  * @inheritDoc
18
18
  */
@@ -8,14 +8,14 @@
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
9
  import { Paragraph } from 'ckeditor5/src/paragraph.js';
10
10
  import { priorities } from 'ckeditor5/src/utils.js';
11
- import HeadingCommand from './headingcommand.js';
11
+ import { HeadingCommand } from './headingcommand.js';
12
12
  const defaultModelElement = 'paragraph';
13
13
  /**
14
14
  * The headings engine feature. It handles switching between block formats – headings and paragraph.
15
15
  * This class represents the engine part of the heading feature. See also {@link module:heading/heading~Heading}.
16
16
  * It introduces `heading1`-`headingN` commands which allow to convert paragraphs into headings.
17
17
  */
18
- export default class HeadingEditing extends Plugin {
18
+ export class HeadingEditing extends Plugin {
19
19
  /**
20
20
  * @inheritDoc
21
21
  */
@@ -10,7 +10,7 @@ import '../theme/heading.css';
10
10
  /**
11
11
  * The headings UI feature. It introduces the `headings` dropdown.
12
12
  */
13
- export default class HeadingUI extends Plugin {
13
+ export declare class HeadingUI extends Plugin {
14
14
  /**
15
15
  * @inheritDoc
16
16
  */
package/src/headingui.js CHANGED
@@ -6,14 +6,14 @@
6
6
  * @module heading/headingui
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
- import { ViewModel, createDropdown, addListToDropdown, MenuBarMenuListItemView, MenuBarMenuListView, MenuBarMenuView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
9
+ import { UIModel, createDropdown, addListToDropdown, MenuBarMenuListItemView, MenuBarMenuListView, MenuBarMenuView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
10
10
  import { Collection } from 'ckeditor5/src/utils.js';
11
11
  import { getLocalizedOptions } from './utils.js';
12
12
  import '../theme/heading.css';
13
13
  /**
14
14
  * The headings UI feature. It introduces the `headings` dropdown.
15
15
  */
16
- export default class HeadingUI extends Plugin {
16
+ export class HeadingUI extends Plugin {
17
17
  /**
18
18
  * @inheritDoc
19
19
  */
@@ -45,7 +45,7 @@ export default class HeadingUI extends Plugin {
45
45
  for (const option of options) {
46
46
  const def = {
47
47
  type: 'button',
48
- model: new ViewModel({
48
+ model: new UIModel({
49
49
  label: option.title,
50
50
  class: option.class,
51
51
  role: 'menuitemradio',
package/src/index.d.ts CHANGED
@@ -5,12 +5,13 @@
5
5
  /**
6
6
  * @module heading
7
7
  */
8
- export { default as Heading } from './heading.js';
8
+ export { Heading } from './heading.js';
9
9
  export type { HeadingOption, HeadingElementOption } from './headingconfig.js';
10
- export { default as HeadingEditing } from './headingediting.js';
11
- export { default as HeadingUI } from './headingui.js';
12
- export { default as HeadingButtonsUI } from './headingbuttonsui.js';
13
- export { default as Title, type TitleConfig } from './title.js';
14
- export type { HeadingConfig } from './headingconfig.js';
15
- export type { default as HeadingCommand } from './headingcommand.js';
10
+ export { HeadingEditing } from './headingediting.js';
11
+ export { HeadingUI } from './headingui.js';
12
+ export { HeadingButtonsUI } from './headingbuttonsui.js';
13
+ export { HeadingCommand } from './headingcommand.js';
14
+ export { Title, type HeadingTitleConfig } from './title.js';
15
+ export type { HeadingConfig, HeadingParagraphOption } from './headingconfig.js';
16
+ export { getLocalizedOptions as _getLocalizedHeadingOptions } from './utils.js';
16
17
  import './augmentation.js';
package/src/index.js CHANGED
@@ -5,9 +5,11 @@
5
5
  /**
6
6
  * @module heading
7
7
  */
8
- export { default as Heading } from './heading.js';
9
- export { default as HeadingEditing } from './headingediting.js';
10
- export { default as HeadingUI } from './headingui.js';
11
- export { default as HeadingButtonsUI } from './headingbuttonsui.js';
12
- export { default as Title } from './title.js';
8
+ export { Heading } from './heading.js';
9
+ export { HeadingEditing } from './headingediting.js';
10
+ export { HeadingUI } from './headingui.js';
11
+ export { HeadingButtonsUI } from './headingbuttonsui.js';
12
+ export { HeadingCommand } from './headingcommand.js';
13
+ export { Title } from './title.js';
14
+ export { getLocalizedOptions as _getLocalizedHeadingOptions } from './utils.js';
13
15
  import './augmentation.js';
package/src/title.d.ts CHANGED
@@ -11,7 +11,7 @@ import { Plugin } from 'ckeditor5/src/core.js';
11
11
  *
12
12
  * It splits the document into `Title` and `Body` sections.
13
13
  */
14
- export default class Title extends Plugin {
14
+ export declare class Title extends Plugin {
15
15
  /**
16
16
  * A reference to an empty paragraph in the body
17
17
  * created when there is no element in the body for the placeholder purposes.
@@ -109,11 +109,11 @@ export default class Title extends Plugin {
109
109
  *
110
110
  * See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.
111
111
  */
112
- export interface TitleConfig {
112
+ export interface HeadingTitleConfig {
113
113
  /**
114
114
  * Defines a custom value of the placeholder for the title field.
115
115
  *
116
- * Read more in {@link module:heading/title~TitleConfig}.
116
+ * Read more in {@link module:heading/title~HeadingTitleConfig}.
117
117
  */
118
118
  placeholder?: string;
119
119
  }
package/src/title.js CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
9
  import { first } from 'ckeditor5/src/utils.js';
10
- import { DowncastWriter, enablePlaceholder, hidePlaceholder, needsPlaceholder, showPlaceholder } from 'ckeditor5/src/engine.js';
10
+ import { ViewDowncastWriter, enableViewPlaceholder, hideViewPlaceholder, needsViewPlaceholder, showViewPlaceholder } from 'ckeditor5/src/engine.js';
11
11
  // A list of element names that should be treated by the Title plugin as title-like.
12
12
  // This means that an element of a type from this list will be changed to a title element
13
13
  // when it is the first element in the root.
@@ -17,7 +17,7 @@ const titleLikeElements = new Set(['paragraph', 'heading1', 'heading2', 'heading
17
17
  *
18
18
  * It splits the document into `Title` and `Body` sections.
19
19
  */
20
- export default class Title extends Plugin {
20
+ export class Title extends Plugin {
21
21
  /**
22
22
  * A reference to an empty paragraph in the body
23
23
  * created when there is no element in the body for the placeholder purposes.
@@ -127,7 +127,7 @@ export default class Title extends Plugin {
127
127
  const rootName = options.rootName ? options.rootName : undefined;
128
128
  const root = editor.model.document.getRoot(rootName);
129
129
  const view = editor.editing.view;
130
- const viewWriter = new DowncastWriter(view.document);
130
+ const viewWriter = new ViewDowncastWriter(view.document);
131
131
  const rootRange = model.createRangeIn(root);
132
132
  const viewDocumentFragment = viewWriter.createDocumentFragment();
133
133
  // Find all markers that intersects with body.
@@ -275,7 +275,7 @@ export default class Title extends Plugin {
275
275
  editor.editing.downcastDispatcher.on('insert:title-content', (evt, data, conversionApi) => {
276
276
  const element = conversionApi.mapper.toViewElement(data.item);
277
277
  element.placeholder = titlePlaceholder;
278
- enablePlaceholder({
278
+ enableViewPlaceholder({
279
279
  view,
280
280
  element,
281
281
  keepOnFocus: true
@@ -298,7 +298,7 @@ export default class Title extends Plugin {
298
298
  // If body element has changed we need to disable placeholder on the previous element and enable on the new one.
299
299
  if (body !== oldBody) {
300
300
  if (oldBody) {
301
- hidePlaceholder(writer, oldBody);
301
+ hideViewPlaceholder(writer, oldBody);
302
302
  writer.removeAttribute('data-placeholder', oldBody);
303
303
  }
304
304
  writer.setAttribute('data-placeholder', bodyPlaceholder, body);
@@ -307,12 +307,12 @@ export default class Title extends Plugin {
307
307
  }
308
308
  // Then we need to display placeholder if it is needed.
309
309
  // See: https://github.com/ckeditor/ckeditor5/issues/8689.
310
- if (needsPlaceholder(body, true) && viewRoot.childCount === 2 && body.name === 'p') {
311
- hasChanged = showPlaceholder(writer, body) ? true : hasChanged;
310
+ if (needsViewPlaceholder(body, true) && viewRoot.childCount === 2 && body.name === 'p') {
311
+ hasChanged = showViewPlaceholder(writer, body) ? true : hasChanged;
312
312
  }
313
313
  else {
314
314
  // Or hide if it is not needed.
315
- hasChanged = hidePlaceholder(writer, body) ? true : hasChanged;
315
+ hasChanged = hideViewPlaceholder(writer, body) ? true : hasChanged;
316
316
  }
317
317
  }
318
318
  return hasChanged;
package/src/utils.d.ts CHANGED
@@ -14,5 +14,7 @@ import type { HeadingOption } from './headingconfig.js';
14
14
  *
15
15
  * Note: The reason behind this method is that there is no way to use {@link module:utils/locale~Locale#t}
16
16
  * when the user configuration is defined because the editor does not exist yet.
17
+ *
18
+ * @internal
17
19
  */
18
20
  export declare function getLocalizedOptions(editor: Editor): Array<HeadingOption>;
package/src/utils.js CHANGED
@@ -9,6 +9,8 @@
9
9
  *
10
10
  * Note: The reason behind this method is that there is no way to use {@link module:utils/locale~Locale#t}
11
11
  * when the user configuration is defined because the editor does not exist yet.
12
+ *
13
+ * @internal
12
14
  */
13
15
  export function getLocalizedOptions(editor) {
14
16
  const t = editor.t;