@ckeditor/ckeditor5-style 48.2.0-alpha.7 → 48.3.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.
@@ -1,42 +1,42 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module style/integrations/link
7
- */
8
- import { Plugin } from '@ckeditor/ckeditor5-core';
9
- import { GeneralHtmlSupport } from '@ckeditor/ckeditor5-html-support';
10
- import { StyleUtils } from '../styleutils.js';
6
+ * @module style/integrations/link
7
+ */
8
+ import { Plugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
9
+ import { GeneralHtmlSupport } from "@ckeditor/ckeditor5-html-support";
10
+ import { StyleUtils } from "../styleutils.js";
11
11
  export declare class LinkStyleSupport extends Plugin {
12
- private _styleUtils;
13
- private _htmlSupport;
14
- /**
15
- * @inheritDoc
16
- */
17
- static get pluginName(): "LinkStyleSupport";
18
- /**
19
- * @inheritDoc
20
- */
21
- static get isOfficialPlugin(): true;
22
- /**
23
- * @inheritDoc
24
- */
25
- static get requires(): readonly [typeof StyleUtils, typeof GeneralHtmlSupport];
26
- /**
27
- * @inheritDoc
28
- */
29
- init(): void;
30
- /**
31
- * Verifies if the given style is applicable to the provided document selection.
32
- */
33
- private _isStyleEnabled;
34
- /**
35
- * Returns true if the given style is applied to the specified document selection.
36
- */
37
- private _isStyleActive;
38
- /**
39
- * Returns a selectable that given style should be applied to.
40
- */
41
- private _getAffectedSelectable;
12
+ private _styleUtils;
13
+ private _htmlSupport;
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get pluginName(): "LinkStyleSupport";
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static override get isOfficialPlugin(): true;
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get requires(): PluginDependenciesOf<[StyleUtils, GeneralHtmlSupport]>;
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ init(): void;
30
+ /**
31
+ * Verifies if the given style is applicable to the provided document selection.
32
+ */
33
+ private _isStyleEnabled;
34
+ /**
35
+ * Returns true if the given style is applied to the specified document selection.
36
+ */
37
+ private _isStyleActive;
38
+ /**
39
+ * Returns a selectable that given style should be applied to.
40
+ */
41
+ private _getAffectedSelectable;
42
42
  }
@@ -1,47 +1,47 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module style/integrations/list
7
- */
8
- import { Plugin } from '@ckeditor/ckeditor5-core';
9
- import { GeneralHtmlSupport } from '@ckeditor/ckeditor5-html-support';
10
- import { StyleUtils } from '../styleutils.js';
6
+ * @module style/integrations/list
7
+ */
8
+ import { Plugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
9
+ import { GeneralHtmlSupport } from "@ckeditor/ckeditor5-html-support";
10
+ import { StyleUtils } from "../styleutils.js";
11
11
  export declare class ListStyleSupport extends Plugin {
12
- private _listUtils;
13
- private _styleUtils;
14
- private _htmlSupport;
15
- /**
16
- * @inheritDoc
17
- */
18
- static get pluginName(): "ListStyleSupport";
19
- /**
20
- * @inheritDoc
21
- */
22
- static get isOfficialPlugin(): true;
23
- /**
24
- * @inheritDoc
25
- */
26
- static get requires(): readonly [typeof StyleUtils, typeof GeneralHtmlSupport];
27
- /**
28
- * @inheritDoc
29
- */
30
- init(): void;
31
- /**
32
- * Verifies if the given style is applicable to the provided block element.
33
- */
34
- private _isStyleEnabledForBlock;
35
- /**
36
- * Returns true if the given style is applied to the specified block element.
37
- */
38
- private _isStyleActiveForBlock;
39
- /**
40
- * Returns an array of block elements that style should be applied to.
41
- */
42
- private _getAffectedBlocks;
43
- /**
44
- * Returns a view template definition for the style preview.
45
- */
46
- private _getStylePreview;
12
+ private _listUtils;
13
+ private _styleUtils;
14
+ private _htmlSupport;
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ static get pluginName(): "ListStyleSupport";
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static override get isOfficialPlugin(): true;
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get requires(): PluginDependenciesOf<[StyleUtils, GeneralHtmlSupport]>;
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ init(): void;
31
+ /**
32
+ * Verifies if the given style is applicable to the provided block element.
33
+ */
34
+ private _isStyleEnabledForBlock;
35
+ /**
36
+ * Returns true if the given style is applied to the specified block element.
37
+ */
38
+ private _isStyleActiveForBlock;
39
+ /**
40
+ * Returns an array of block elements that style should be applied to.
41
+ */
42
+ private _getAffectedBlocks;
43
+ /**
44
+ * Returns a view template definition for the style preview.
45
+ */
46
+ private _getStylePreview;
47
47
  }
@@ -1,53 +1,53 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module style/integrations/table
7
- */
8
- import { Plugin } from '@ckeditor/ckeditor5-core';
9
- import { StyleUtils } from '../styleutils.js';
6
+ * @module style/integrations/table
7
+ */
8
+ import { Plugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
9
+ import { StyleUtils } from "../styleutils.js";
10
10
  export declare class TableStyleSupport extends Plugin {
11
- private _tableUtils;
12
- private _styleUtils;
13
- /**
14
- * @inheritDoc
15
- */
16
- static get pluginName(): "TableStyleSupport";
17
- /**
18
- * @inheritDoc
19
- */
20
- static get isOfficialPlugin(): true;
21
- /**
22
- * @inheritDoc
23
- */
24
- static get requires(): readonly [typeof StyleUtils];
25
- /**
26
- * @inheritDoc
27
- */
28
- init(): void;
29
- /**
30
- * Checks if this plugin's custom logic should be applied for defintion-block pair.
31
- *
32
- * @param definition Style definition that is being considered.
33
- * @param block Block element to check if should be styled.
34
- * @returns True if the defintion-block pair meet the plugin criteria, false otherwise.
35
- */
36
- private _isApplicable;
37
- /**
38
- * Checks if the style definition should be applied to selected block.
39
- *
40
- * @param definition Style definition that is being considered.
41
- * @param block Block element to check if should be styled.
42
- * @returns True if the block should be style with the style description, false otherwise.
43
- */
44
- private _isStyleEnabledForBlock;
45
- /**
46
- * Gets all blocks that the style should be applied to.
47
- *
48
- * @param definition Style definition that is being considered.
49
- * @param block A block element from selection.
50
- * @returns An array with the block that was passed as an argument if meets the criteria, null otherwise.
51
- */
52
- private _getAffectedBlocks;
11
+ private _tableUtils;
12
+ private _styleUtils;
13
+ /**
14
+ * @inheritDoc
15
+ */
16
+ static get pluginName(): "TableStyleSupport";
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static override get isOfficialPlugin(): true;
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ static get requires(): PluginDependenciesOf<[StyleUtils]>;
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ init(): void;
29
+ /**
30
+ * Checks if this plugin's custom logic should be applied for defintion-block pair.
31
+ *
32
+ * @param definition Style definition that is being considered.
33
+ * @param block Block element to check if should be styled.
34
+ * @returns True if the defintion-block pair meet the plugin criteria, false otherwise.
35
+ */
36
+ private _isApplicable;
37
+ /**
38
+ * Checks if the style definition should be applied to selected block.
39
+ *
40
+ * @param definition Style definition that is being considered.
41
+ * @param block Block element to check if should be styled.
42
+ * @returns True if the block should be style with the style description, false otherwise.
43
+ */
44
+ private _isStyleEnabledForBlock;
45
+ /**
46
+ * Gets all blocks that the style should be applied to.
47
+ *
48
+ * @param definition Style definition that is being considered.
49
+ * @param block A block element from selection.
50
+ * @returns An array with the block that was passed as an argument if meets the criteria, null otherwise.
51
+ */
52
+ private _getAffectedBlocks;
53
53
  }
package/dist/style.d.ts CHANGED
@@ -1,30 +1,30 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module style/style
7
- */
8
- import { Plugin } from '@ckeditor/ckeditor5-core';
9
- import { StyleUI } from './styleui.js';
10
- import { StyleEditing } from './styleediting.js';
6
+ * @module style/style
7
+ */
8
+ import { Plugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
9
+ import { StyleUI } from "./styleui.js";
10
+ import { StyleEditing } from "./styleediting.js";
11
11
  /**
12
- * The style plugin.
13
- *
14
- * This is a "glue" plugin that loads the {@link module:style/styleediting~StyleEditing style editing feature}
15
- * and {@link module:style/styleui~StyleUI style UI feature}.
16
- */
12
+ * The style plugin.
13
+ *
14
+ * This is a "glue" plugin that loads the {@link module:style/styleediting~StyleEditing style editing feature}
15
+ * and {@link module:style/styleui~StyleUI style UI feature}.
16
+ */
17
17
  export declare class Style extends Plugin {
18
- /**
19
- * @inheritDoc
20
- */
21
- static get pluginName(): "Style";
22
- /**
23
- * @inheritDoc
24
- */
25
- static get isOfficialPlugin(): true;
26
- /**
27
- * @inheritDoc
28
- */
29
- static get requires(): readonly [typeof StyleEditing, typeof StyleUI];
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get pluginName(): "Style";
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static override get isOfficialPlugin(): true;
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get requires(): PluginDependenciesOf<[StyleEditing, StyleUI]>;
30
30
  }
@@ -1,82 +1,82 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- import { Command, type Editor } from '@ckeditor/ckeditor5-core';
6
- import { type NormalizedStyleDefinitions } from './styleutils.js';
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ import { Command, type Editor } from "@ckeditor/ckeditor5-core";
6
+ import { type NormalizedStyleDefinitions } from "./styleutils.js";
7
7
  /**
8
- * Style command.
9
- *
10
- * Applies and removes styles from selection and elements.
11
- */
8
+ * Style command.
9
+ *
10
+ * Applies and removes styles from selection and elements.
11
+ */
12
12
  export declare class StyleCommand extends Command {
13
- /**
14
- * Set of currently applied styles on the current selection.
15
- *
16
- * Names of styles correspond to the `name` property of
17
- * {@link module:style/styleconfig~StyleDefinition configured definitions}.
18
- *
19
- * @observable
20
- */
21
- value: Array<string>;
22
- /**
23
- * Names of enabled styles (styles that can be applied to the current selection).
24
- *
25
- * Names of enabled styles correspond to the `name` property of
26
- * {@link module:style/styleconfig~StyleDefinition configured definitions}.
27
- *
28
- * @observable
29
- */
30
- enabledStyles: Array<string>;
31
- /**
32
- * Normalized definitions of the styles.
33
- */
34
- private readonly _styleDefinitions;
35
- /**
36
- * The StyleUtils plugin.
37
- */
38
- private _styleUtils;
39
- /**
40
- * Creates an instance of the command.
41
- *
42
- * @param editor Editor on which this command will be used.
43
- * @param styleDefinitions Normalized definitions of the styles.
44
- */
45
- constructor(editor: Editor, styleDefinitions: NormalizedStyleDefinitions);
46
- /**
47
- * @inheritDoc
48
- */
49
- refresh(): void;
50
- /**
51
- * Executes the command &ndash; applies the style classes to the selection or removes it from the selection.
52
- *
53
- * If the command value already contains the requested style, it will remove the style classes. Otherwise, it will set it.
54
- *
55
- * The execution result differs, depending on the {@link module:engine/model/document~ModelDocument#selection} and the
56
- * style type (inline or block):
57
- *
58
- * * When applying inline styles:
59
- * * If the selection is on a range, the command applies the style classes to all nodes in that range.
60
- * * If the selection is collapsed in a non-empty node, the command applies the style classes to the
61
- * {@link module:engine/model/document~ModelDocument#selection}.
62
- *
63
- * * When applying block styles:
64
- * * If the selection is on a range, the command applies the style classes to the nearest block parent element.
65
- *
66
- * @fires execute
67
- * @param options Command options.
68
- * @param options.styleName Style name matching the one defined in the
69
- * {@link module:style/styleconfig~StyleConfig#definitions configuration}.
70
- * @param options.forceValue Whether the command should add given style (`true`) or remove it (`false`) from the selection.
71
- * If not set (default), the command will toggle the style basing on the first selected node. Note, that this will not force
72
- * setting a style on an element that cannot receive given style.
73
- */
74
- execute({ styleName, forceValue }: {
75
- styleName: string;
76
- forceValue?: boolean;
77
- }): void;
78
- /**
79
- * Returns a set of elements that should be affected by the block-style change.
80
- */
81
- private _findAffectedBlocks;
13
+ /**
14
+ * Set of currently applied styles on the current selection.
15
+ *
16
+ * Names of styles correspond to the `name` property of
17
+ * {@link module:style/styleconfig~StyleDefinition configured definitions}.
18
+ *
19
+ * @observable
20
+ */
21
+ value: Array<string>;
22
+ /**
23
+ * Names of enabled styles (styles that can be applied to the current selection).
24
+ *
25
+ * Names of enabled styles correspond to the `name` property of
26
+ * {@link module:style/styleconfig~StyleDefinition configured definitions}.
27
+ *
28
+ * @observable
29
+ */
30
+ enabledStyles: Array<string>;
31
+ /**
32
+ * Normalized definitions of the styles.
33
+ */
34
+ private readonly _styleDefinitions;
35
+ /**
36
+ * The StyleUtils plugin.
37
+ */
38
+ private _styleUtils;
39
+ /**
40
+ * Creates an instance of the command.
41
+ *
42
+ * @param editor Editor on which this command will be used.
43
+ * @param styleDefinitions Normalized definitions of the styles.
44
+ */
45
+ constructor(editor: Editor, styleDefinitions: NormalizedStyleDefinitions);
46
+ /**
47
+ * @inheritDoc
48
+ */
49
+ override refresh(): void;
50
+ /**
51
+ * Executes the command &ndash; applies the style classes to the selection or removes it from the selection.
52
+ *
53
+ * If the command value already contains the requested style, it will remove the style classes. Otherwise, it will set it.
54
+ *
55
+ * The execution result differs, depending on the {@link module:engine/model/document~ModelDocument#selection} and the
56
+ * style type (inline or block):
57
+ *
58
+ * * When applying inline styles:
59
+ * * If the selection is on a range, the command applies the style classes to all nodes in that range.
60
+ * * If the selection is collapsed in a non-empty node, the command applies the style classes to the
61
+ * {@link module:engine/model/document~ModelDocument#selection}.
62
+ *
63
+ * * When applying block styles:
64
+ * * If the selection is on a range, the command applies the style classes to the nearest block parent element.
65
+ *
66
+ * @fires execute
67
+ * @param options Command options.
68
+ * @param options.styleName Style name matching the one defined in the
69
+ * {@link module:style/styleconfig~StyleConfig#definitions configuration}.
70
+ * @param options.forceValue Whether the command should add given style (`true`) or remove it (`false`) from the selection.
71
+ * If not set (default), the command will toggle the style basing on the first selected node. Note, that this will not force
72
+ * setting a style on an element that cannot receive given style.
73
+ */
74
+ override execute({ styleName, forceValue }: {
75
+ styleName: string;
76
+ forceValue?: boolean;
77
+ }): void;
78
+ /**
79
+ * Returns a set of elements that should be affected by the block-style change.
80
+ */
81
+ private _findAffectedBlocks;
82
82
  }