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 image/imagestyle/utils
|
7 | */
|
8 | import { type Editor, type PluginCollection } from 'ckeditor5/src/core';
|
9 | import type { ImageStyleConfig, ImageStyleDropdownDefinition, ImageStyleOptionDefinition } from '../imageconfig';
|
10 | /**
|
11 | * Default image style options provided by the plugin that can be referred in the {@link module:image/imageconfig~ImageConfig#styles}
|
12 | * configuration.
|
13 | *
|
14 | * There are available 5 styles focused on formatting:
|
15 | *
|
16 | * * **`'alignLeft'`** aligns the inline or block image to the left and wraps it with the text using the `image-style-align-left` class,
|
17 | * * **`'alignRight'`** aligns the inline or block image to the right and wraps it with the text using the `image-style-align-right` class,
|
18 | * * **`'alignCenter'`** centers the block image using the `image-style-align-center` class,
|
19 | * * **`'alignBlockLeft'`** aligns the block image to the left using the `image-style-block-align-left` class,
|
20 | * * **`'alignBlockRight'`** aligns the block image to the right using the `image-style-block-align-right` class,
|
21 | *
|
22 | * and 3 semantic styles:
|
23 | *
|
24 | * * **`'inline'`** is an inline image without any CSS class,
|
25 | * * **`'block'`** is a block image without any CSS class,
|
26 | * * **`'side'`** is a block image styled with the `image-style-side` CSS class.
|
27 | */
|
28 | export declare const DEFAULT_OPTIONS: Record<string, ImageStyleOptionDefinition>;
|
29 | /**
|
30 | * Default image style icons provided by the plugin that can be referred in the {@link module:image/imageconfig~ImageConfig#styles}
|
31 | * configuration.
|
32 | *
|
33 | * See {@link module:image/imageconfig~ImageStyleOptionDefinition#icon} to learn more.
|
34 | *
|
35 | * There are 7 default icons available: `'full'`, `'left'`, `'inlineLeft'`, `'center'`, `'right'`, `'inlineRight'`, and `'inline'`.
|
36 | */
|
37 | export declare const DEFAULT_ICONS: Record<string, string>;
|
38 | /**
|
39 | * Default drop-downs provided by the plugin that can be referred in the {@link module:image/imageconfig~ImageConfig#toolbar}
|
40 | * configuration. The drop-downs are containers for the {@link module:image/imageconfig~ImageStyleConfig#options image style options}.
|
41 | *
|
42 | * If both of the `ImageEditing` plugins are loaded, there are 2 predefined drop-downs available:
|
43 | *
|
44 | * * **`'imageStyle:wrapText'`**, which contains the `alignLeft` and `alignRight` options, that is,
|
45 | * those that wraps the text around the image,
|
46 | * * **`'imageStyle:breakText'`**, which contains the `alignBlockLeft`, `alignCenter` and `alignBlockRight` options, that is,
|
47 | * those that breaks the text around the image.
|
48 | */
|
49 | export declare const DEFAULT_DROPDOWN_DEFINITIONS: Array<ImageStyleDropdownDefinition>;
|
50 | /**
|
51 | * Returns a list of the normalized and validated image style options.
|
52 | *
|
53 | * @param config
|
54 | * @param config.isInlinePluginLoaded
|
55 | * Determines whether the {@link module:image/image/imageblockediting~ImageBlockEditing `ImageBlockEditing`} plugin has been loaded.
|
56 | * @param config.isBlockPluginLoaded
|
57 | * Determines whether the {@link module:image/image/imageinlineediting~ImageInlineEditing `ImageInlineEditing`} plugin has been loaded.
|
58 | * @param config.configuredStyles
|
59 | * The image styles configuration provided in the image styles {@link module:image/imageconfig~ImageConfig#styles configuration}
|
60 | * as a default or custom value.
|
61 | * @returns
|
62 | * * Each of options contains a complete icon markup.
|
63 | * * The image style options not supported by any of the loaded plugins are filtered out.
|
64 | */
|
65 | declare function normalizeStyles(config: {
|
66 | isInlinePluginLoaded: boolean;
|
67 | isBlockPluginLoaded: boolean;
|
68 | configuredStyles: ImageStyleConfig;
|
69 | }): Array<ImageStyleOptionDefinition>;
|
70 | /**
|
71 | * Returns the default image styles configuration depending on the loaded image editing plugins.
|
72 | *
|
73 | * @param isInlinePluginLoaded
|
74 | * Determines whether the {@link module:image/image/imageblockediting~ImageBlockEditing `ImageBlockEditing`} plugin has been loaded.
|
75 | *
|
76 | * @param isBlockPluginLoaded
|
77 | * Determines whether the {@link module:image/image/imageinlineediting~ImageInlineEditing `ImageInlineEditing`} plugin has been loaded.
|
78 | *
|
79 | * @returns
|
80 | * It returns an object with the lists of the image style options and groups defined as strings related to the
|
81 | * {@link module:image/imagestyle/utils#DEFAULT_OPTIONS default options}
|
82 | */
|
83 | declare function getDefaultStylesConfiguration(isBlockPluginLoaded: boolean, isInlinePluginLoaded: boolean): ImageStyleConfig;
|
84 | /**
|
85 | * Returns a list of the available predefined drop-downs' definitions depending on the loaded image editing plugins.
|
86 | */
|
87 | declare function getDefaultDropdownDefinitions(pluginCollection: PluginCollection<Editor>): Array<ImageStyleDropdownDefinition>;
|
88 | /**
|
89 | * Displays a console warning with the 'image-style-configuration-definition-invalid' error.
|
90 | */
|
91 | declare function warnInvalidStyle(info: object): void;
|
92 | declare const _default: {
|
93 | normalizeStyles: typeof normalizeStyles;
|
94 | getDefaultStylesConfiguration: typeof getDefaultStylesConfiguration;
|
95 | getDefaultDropdownDefinitions: typeof getDefaultDropdownDefinitions;
|
96 | warnInvalidStyle: typeof warnInvalidStyle;
|
97 | DEFAULT_OPTIONS: Record<string, ImageStyleOptionDefinition>;
|
98 | DEFAULT_ICONS: Record<string, string>;
|
99 | DEFAULT_DROPDOWN_DEFINITIONS: ImageStyleDropdownDefinition[];
|
100 | };
|
101 | export default _default;
|