@ckeditor/ckeditor5-image 41.1.0 → 41.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.
- package/build/image.js +1 -1
- package/dist/content-index.css +105 -0
- package/dist/editor-index.css +108 -0
- package/dist/index.css +462 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +5860 -0
- package/dist/index.js.map +1 -0
- package/dist/types/augmentation.d.ts +56 -0
- package/dist/types/autoimage.d.ts +52 -0
- package/dist/types/image/converters.d.ts +66 -0
- package/dist/types/image/imageblockediting.d.ts +59 -0
- package/dist/types/image/imageediting.d.ts +30 -0
- package/dist/types/image/imageinlineediting.d.ts +60 -0
- package/dist/types/image/imageloadobserver.d.ts +48 -0
- package/dist/types/image/imageplaceholder.d.ts +39 -0
- package/dist/types/image/imagetypecommand.d.ts +44 -0
- package/dist/types/image/insertimagecommand.d.ts +66 -0
- package/dist/types/image/replaceimagesourcecommand.d.ts +51 -0
- package/dist/types/image/ui/utils.d.ts +25 -0
- package/dist/types/image/utils.d.ts +64 -0
- package/dist/types/image.d.ts +34 -0
- package/dist/types/imageblock.d.ts +34 -0
- package/dist/types/imagecaption/imagecaptionediting.d.ts +89 -0
- package/dist/types/imagecaption/imagecaptionui.d.ts +26 -0
- package/dist/types/imagecaption/imagecaptionutils.d.ts +38 -0
- package/dist/types/imagecaption/toggleimagecaptioncommand.d.ts +66 -0
- package/dist/types/imagecaption.d.ts +26 -0
- package/dist/types/imageconfig.d.ts +712 -0
- package/dist/types/imageinline.d.ts +34 -0
- package/dist/types/imageinsert/imageinsertui.d.ts +74 -0
- package/dist/types/imageinsert/imageinsertviaurlui.d.ts +44 -0
- package/dist/types/imageinsert/ui/imageinsertformview.d.ts +56 -0
- package/dist/types/imageinsert/ui/imageinserturlview.d.ts +107 -0
- package/dist/types/imageinsert.d.ts +33 -0
- package/dist/types/imageinsertviaurl.d.ts +31 -0
- package/dist/types/imageresize/imageresizebuttons.d.ts +67 -0
- package/dist/types/imageresize/imageresizeediting.d.ts +37 -0
- package/dist/types/imageresize/imageresizehandles.d.ts +31 -0
- package/dist/types/imageresize/resizeimagecommand.d.ts +42 -0
- package/dist/types/imageresize.d.ts +27 -0
- package/dist/types/imagesizeattributes.d.ts +34 -0
- package/dist/types/imagestyle/converters.d.ts +24 -0
- package/dist/types/imagestyle/imagestylecommand.d.ts +68 -0
- package/dist/types/imagestyle/imagestyleediting.d.ts +50 -0
- package/dist/types/imagestyle/imagestyleui.d.ts +56 -0
- package/dist/types/imagestyle/utils.d.ts +101 -0
- package/dist/types/imagestyle.d.ts +32 -0
- package/dist/types/imagetextalternative/imagetextalternativecommand.d.ts +34 -0
- package/dist/types/imagetextalternative/imagetextalternativeediting.d.ts +28 -0
- package/dist/types/imagetextalternative/imagetextalternativeui.d.ts +68 -0
- package/dist/types/imagetextalternative/ui/textalternativeformview.d.ts +90 -0
- package/dist/types/imagetextalternative.d.ts +29 -0
- package/dist/types/imagetoolbar.d.ts +35 -0
- package/dist/types/imageupload/imageuploadediting.d.ts +111 -0
- package/dist/types/imageupload/imageuploadprogress.d.ts +42 -0
- package/dist/types/imageupload/imageuploadui.d.ts +23 -0
- package/dist/types/imageupload/uploadimagecommand.d.ts +60 -0
- package/dist/types/imageupload/utils.d.ts +33 -0
- package/dist/types/imageupload.d.ts +32 -0
- package/dist/types/imageutils.d.ts +125 -0
- package/dist/types/index.d.ts +48 -0
- package/dist/types/pictureediting.d.ts +88 -0
- package/lang/translations/he.po +1 -1
- package/package.json +4 -3
- package/src/augmentation.d.ts +1 -1
- package/src/imageinsert/imageinsertui.d.ts +4 -2
- package/src/imageinsert/imageinsertui.js +1 -1
- package/src/imageinsert/imageinsertviaurlui.d.ts +1 -1
- package/src/imageinsert/imageinsertviaurlui.js +2 -3
- package/src/imageresize/imageresizehandles.js +1 -2
- package/src/imageupload/imageuploadui.js +1 -2
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
* @module image/imagestyle/imagestylecommand
|
|
7
|
+
*/
|
|
8
|
+
import type { Element } from 'ckeditor5/src/engine.js';
|
|
9
|
+
import { Command, type Editor } from 'ckeditor5/src/core.js';
|
|
10
|
+
import type { ImageStyleOptionDefinition } from '../imageconfig.js';
|
|
11
|
+
/**
|
|
12
|
+
* The image style command. It is used to apply {@link module:image/imageconfig~ImageStyleConfig#options image style option}
|
|
13
|
+
* to a selected image.
|
|
14
|
+
*
|
|
15
|
+
* **Note**: Executing this command may change the image model element if the desired style requires an image of a different
|
|
16
|
+
* type. See {@link module:image/imagestyle/imagestylecommand~ImageStyleCommand#execute} to learn more.
|
|
17
|
+
*/
|
|
18
|
+
export default class ImageStyleCommand extends Command {
|
|
19
|
+
/**
|
|
20
|
+
* An object containing names of default style options for the inline and block images.
|
|
21
|
+
* If there is no default style option for the given image type in the configuration,
|
|
22
|
+
* the name will be `false`.
|
|
23
|
+
*/
|
|
24
|
+
private _defaultStyles;
|
|
25
|
+
/**
|
|
26
|
+
* The styles handled by this command.
|
|
27
|
+
*/
|
|
28
|
+
private _styles;
|
|
29
|
+
/**
|
|
30
|
+
* Creates an instance of the image style command. When executed, the command applies one of
|
|
31
|
+
* {@link module:image/imageconfig~ImageStyleConfig#options style options} to the currently selected image.
|
|
32
|
+
*
|
|
33
|
+
* @param editor The editor instance.
|
|
34
|
+
* @param styles The style options that this command supports.
|
|
35
|
+
*/
|
|
36
|
+
constructor(editor: Editor, styles: Array<ImageStyleOptionDefinition>);
|
|
37
|
+
/**
|
|
38
|
+
* @inheritDoc
|
|
39
|
+
*/
|
|
40
|
+
refresh(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Executes the command and applies the style to the currently selected image:
|
|
43
|
+
*
|
|
44
|
+
* ```ts
|
|
45
|
+
* editor.execute( 'imageStyle', { value: 'side' } );
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* **Note**: Executing this command may change the image model element if the desired style requires an image
|
|
49
|
+
* of a different type. Learn more about {@link module:image/imageconfig~ImageStyleOptionDefinition#modelElements model element}
|
|
50
|
+
* configuration for the style option.
|
|
51
|
+
*
|
|
52
|
+
* @param options.value The name of the style (as configured in {@link module:image/imageconfig~ImageStyleConfig#options}).
|
|
53
|
+
* @param options.setImageSizes Specifies whether the image `width` and `height` attributes should be set automatically.
|
|
54
|
+
* The default is `true`.
|
|
55
|
+
* @fires execute
|
|
56
|
+
*/
|
|
57
|
+
execute(options?: {
|
|
58
|
+
value?: string;
|
|
59
|
+
setImageSizes?: boolean;
|
|
60
|
+
}): void;
|
|
61
|
+
/**
|
|
62
|
+
* Returns `true` if requested style change would trigger the image type change.
|
|
63
|
+
*
|
|
64
|
+
* @param requestedStyle The name of the style (as configured in {@link module:image/imageconfig~ImageStyleConfig#options}).
|
|
65
|
+
* @param imageElement The image model element.
|
|
66
|
+
*/
|
|
67
|
+
shouldConvertImageType(requestedStyle: string, imageElement: Element): boolean;
|
|
68
|
+
}
|
|
@@ -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
|
+
* @module image/imagestyle/imagestyleediting
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import ImageUtils from '../imageutils.js';
|
|
10
|
+
import type { ImageStyleOptionDefinition } from '../imageconfig.js';
|
|
11
|
+
/**
|
|
12
|
+
* The image style engine plugin. It sets the default configuration, creates converters and registers
|
|
13
|
+
* {@link module:image/imagestyle/imagestylecommand~ImageStyleCommand ImageStyleCommand}.
|
|
14
|
+
*/
|
|
15
|
+
export default class ImageStyleEditing extends Plugin {
|
|
16
|
+
/**
|
|
17
|
+
* @inheritDoc
|
|
18
|
+
*/
|
|
19
|
+
static get pluginName(): "ImageStyleEditing";
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get requires(): readonly [typeof ImageUtils];
|
|
24
|
+
/**
|
|
25
|
+
* It contains a list of the normalized and validated style options.
|
|
26
|
+
*
|
|
27
|
+
* * Each option contains a complete icon markup.
|
|
28
|
+
* * The style options not supported by any of the loaded image editing plugins (
|
|
29
|
+
* {@link module:image/image/imageinlineediting~ImageInlineEditing `ImageInlineEditing`} or
|
|
30
|
+
* {@link module:image/image/imageblockediting~ImageBlockEditing `ImageBlockEditing`}) are filtered out.
|
|
31
|
+
*
|
|
32
|
+
* @internal
|
|
33
|
+
* @readonly
|
|
34
|
+
*/
|
|
35
|
+
normalizedStyles?: Array<ImageStyleOptionDefinition>;
|
|
36
|
+
/**
|
|
37
|
+
* @inheritDoc
|
|
38
|
+
*/
|
|
39
|
+
init(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Sets the editor conversion taking the presence of
|
|
42
|
+
* {@link module:image/image/imageinlineediting~ImageInlineEditing `ImageInlineEditing`}
|
|
43
|
+
* and {@link module:image/image/imageblockediting~ImageBlockEditing `ImageBlockEditing`} plugins into consideration.
|
|
44
|
+
*/
|
|
45
|
+
private _setupConversion;
|
|
46
|
+
/**
|
|
47
|
+
* Registers a post-fixer that will make sure that the style attribute value is correct for a specific image type (block vs inline).
|
|
48
|
+
*/
|
|
49
|
+
private _setupPostFixer;
|
|
50
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
* @module image/imagestyle/imagestyleui
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import ImageStyleEditing from './imagestyleediting.js';
|
|
10
|
+
import '../../theme/imagestyle.css';
|
|
11
|
+
/**
|
|
12
|
+
* The image style UI plugin.
|
|
13
|
+
*
|
|
14
|
+
* It registers buttons corresponding to the {@link module:image/imageconfig~ImageConfig#styles} configuration.
|
|
15
|
+
* It also registers the {@link module:image/imagestyle/utils#DEFAULT_DROPDOWN_DEFINITIONS default drop-downs} and the
|
|
16
|
+
* custom drop-downs defined by the developer in the {@link module:image/imageconfig~ImageConfig#toolbar} configuration.
|
|
17
|
+
*/
|
|
18
|
+
export default class ImageStyleUI extends Plugin {
|
|
19
|
+
/**
|
|
20
|
+
* @inheritDoc
|
|
21
|
+
*/
|
|
22
|
+
static get requires(): readonly [typeof ImageStyleEditing];
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
static get pluginName(): "ImageStyleUI";
|
|
27
|
+
/**
|
|
28
|
+
* Returns the default localized style titles provided by the plugin.
|
|
29
|
+
*
|
|
30
|
+
* The following localized titles corresponding with
|
|
31
|
+
* {@link module:image/imagestyle/utils#DEFAULT_OPTIONS} are available:
|
|
32
|
+
*
|
|
33
|
+
* * `'Wrap text'`,
|
|
34
|
+
* * `'Break text'`,
|
|
35
|
+
* * `'In line'`,
|
|
36
|
+
* * `'Full size image'`,
|
|
37
|
+
* * `'Side image'`,
|
|
38
|
+
* * `'Left aligned image'`,
|
|
39
|
+
* * `'Centered image'`,
|
|
40
|
+
* * `'Right aligned image'`
|
|
41
|
+
*/
|
|
42
|
+
get localizedDefaultStylesTitles(): Record<string, string>;
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
46
|
+
init(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Creates a dropdown and stores it in the editor {@link module:ui/componentfactory~ComponentFactory}.
|
|
49
|
+
*/
|
|
50
|
+
private _createDropdown;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a button and stores it in the editor {@link module:ui/componentfactory~ComponentFactory}.
|
|
53
|
+
*/
|
|
54
|
+
private _createButton;
|
|
55
|
+
private _executeCommand;
|
|
56
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
* @module image/imagestyle/utils
|
|
7
|
+
*/
|
|
8
|
+
import { type Editor, type PluginCollection } from 'ckeditor5/src/core.js';
|
|
9
|
+
import type { ImageStyleConfig, ImageStyleDropdownDefinition, ImageStyleOptionDefinition } from '../imageconfig.js';
|
|
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;
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
* @module image/imagestyle
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import ImageStyleEditing from './imagestyle/imagestyleediting.js';
|
|
10
|
+
import ImageStyleUI from './imagestyle/imagestyleui.js';
|
|
11
|
+
/**
|
|
12
|
+
* The image style plugin.
|
|
13
|
+
*
|
|
14
|
+
* For a detailed overview of the image styles feature, check the {@glink features/images/images-styles documentation}.
|
|
15
|
+
*
|
|
16
|
+
* This is a "glue" plugin which loads the following plugins:
|
|
17
|
+
* * {@link module:image/imagestyle/imagestyleediting~ImageStyleEditing},
|
|
18
|
+
* * {@link module:image/imagestyle/imagestyleui~ImageStyleUI}
|
|
19
|
+
*
|
|
20
|
+
* It provides a default configuration, which can be extended or overwritten.
|
|
21
|
+
* Read more about the {@link module:image/imageconfig~ImageConfig#styles image styles configuration}.
|
|
22
|
+
*/
|
|
23
|
+
export default class ImageStyle extends Plugin {
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
static get requires(): readonly [typeof ImageStyleEditing, typeof ImageStyleUI];
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
static get pluginName(): "ImageStyle";
|
|
32
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
* @module image/imagetextalternative/imagetextalternativecommand
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from 'ckeditor5/src/core.js';
|
|
9
|
+
/**
|
|
10
|
+
* The image text alternative command. It is used to change the `alt` attribute of `<imageBlock>` and `<imageInline>` model elements.
|
|
11
|
+
*/
|
|
12
|
+
export default class ImageTextAlternativeCommand extends Command {
|
|
13
|
+
/**
|
|
14
|
+
* The command value: `false` if there is no `alt` attribute, otherwise the value of the `alt` attribute.
|
|
15
|
+
*
|
|
16
|
+
* @readonly
|
|
17
|
+
* @observable
|
|
18
|
+
*/
|
|
19
|
+
value: string | false;
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
refresh(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Executes the command.
|
|
26
|
+
*
|
|
27
|
+
* @fires execute
|
|
28
|
+
* @param options
|
|
29
|
+
* @param options.newValue The new value of the `alt` attribute to set.
|
|
30
|
+
*/
|
|
31
|
+
execute(options: {
|
|
32
|
+
newValue: string;
|
|
33
|
+
}): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
* @module image/imagetextalternative/imagetextalternativeediting
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import ImageUtils from '../imageutils.js';
|
|
10
|
+
/**
|
|
11
|
+
* The image text alternative editing plugin.
|
|
12
|
+
*
|
|
13
|
+
* Registers the `'imageTextAlternative'` command.
|
|
14
|
+
*/
|
|
15
|
+
export default class ImageTextAlternativeEditing extends Plugin {
|
|
16
|
+
/**
|
|
17
|
+
* @inheritDoc
|
|
18
|
+
*/
|
|
19
|
+
static get requires(): readonly [typeof ImageUtils];
|
|
20
|
+
/**
|
|
21
|
+
* @inheritDoc
|
|
22
|
+
*/
|
|
23
|
+
static get pluginName(): "ImageTextAlternativeEditing";
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
init(): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
* @module image/imagetextalternative/imagetextalternativeui
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { ContextualBalloon } from 'ckeditor5/src/ui.js';
|
|
10
|
+
/**
|
|
11
|
+
* The image text alternative UI plugin.
|
|
12
|
+
*
|
|
13
|
+
* The plugin uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon}.
|
|
14
|
+
*/
|
|
15
|
+
export default class ImageTextAlternativeUI extends Plugin {
|
|
16
|
+
/**
|
|
17
|
+
* The contextual balloon plugin instance.
|
|
18
|
+
*/
|
|
19
|
+
private _balloon?;
|
|
20
|
+
/**
|
|
21
|
+
* A form containing a textarea and buttons, used to change the `alt` text value.
|
|
22
|
+
*/
|
|
23
|
+
private _form?;
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
static get requires(): readonly [typeof ContextualBalloon];
|
|
28
|
+
/**
|
|
29
|
+
* @inheritDoc
|
|
30
|
+
*/
|
|
31
|
+
static get pluginName(): "ImageTextAlternativeUI";
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
init(): void;
|
|
36
|
+
/**
|
|
37
|
+
* @inheritDoc
|
|
38
|
+
*/
|
|
39
|
+
destroy(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a button showing the balloon panel for changing the image text alternative and
|
|
42
|
+
* registers it in the editor {@link module:ui/componentfactory~ComponentFactory ComponentFactory}.
|
|
43
|
+
*/
|
|
44
|
+
private _createButton;
|
|
45
|
+
/**
|
|
46
|
+
* Creates the {@link module:image/imagetextalternative/ui/textalternativeformview~TextAlternativeFormView}
|
|
47
|
+
* form.
|
|
48
|
+
*/
|
|
49
|
+
private _createForm;
|
|
50
|
+
/**
|
|
51
|
+
* Shows the {@link #_form} in the {@link #_balloon}.
|
|
52
|
+
*/
|
|
53
|
+
private _showForm;
|
|
54
|
+
/**
|
|
55
|
+
* Removes the {@link #_form} from the {@link #_balloon}.
|
|
56
|
+
*
|
|
57
|
+
* @param focusEditable Controls whether the editing view is focused afterwards.
|
|
58
|
+
*/
|
|
59
|
+
private _hideForm;
|
|
60
|
+
/**
|
|
61
|
+
* Returns `true` when the {@link #_form} is the visible view in the {@link #_balloon}.
|
|
62
|
+
*/
|
|
63
|
+
private get _isVisible();
|
|
64
|
+
/**
|
|
65
|
+
* Returns `true` when the {@link #_form} is in the {@link #_balloon}.
|
|
66
|
+
*/
|
|
67
|
+
private get _isInBalloon();
|
|
68
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
* @module image/imagetextalternative/ui/textalternativeformview
|
|
7
|
+
*/
|
|
8
|
+
import { ButtonView, FocusCycler, LabeledFieldView, View, ViewCollection, type InputView, type FocusableView } from 'ckeditor5/src/ui.js';
|
|
9
|
+
import { FocusTracker, KeystrokeHandler, type Locale } from 'ckeditor5/src/utils.js';
|
|
10
|
+
import '../../../theme/textalternativeform.css';
|
|
11
|
+
import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
|
|
12
|
+
/**
|
|
13
|
+
* The TextAlternativeFormView class.
|
|
14
|
+
*/
|
|
15
|
+
export default class TextAlternativeFormView extends View {
|
|
16
|
+
/**
|
|
17
|
+
* Tracks information about the DOM focus in the form.
|
|
18
|
+
*/
|
|
19
|
+
readonly focusTracker: FocusTracker;
|
|
20
|
+
/**
|
|
21
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
22
|
+
*/
|
|
23
|
+
readonly keystrokes: KeystrokeHandler;
|
|
24
|
+
/**
|
|
25
|
+
* An input with a label.
|
|
26
|
+
*/
|
|
27
|
+
labeledInput: LabeledFieldView<InputView>;
|
|
28
|
+
/**
|
|
29
|
+
* A button used to submit the form.
|
|
30
|
+
*/
|
|
31
|
+
saveButtonView: ButtonView;
|
|
32
|
+
/**
|
|
33
|
+
* A button used to cancel the form.
|
|
34
|
+
*/
|
|
35
|
+
cancelButtonView: ButtonView;
|
|
36
|
+
/**
|
|
37
|
+
* A collection of views which can be focused in the form.
|
|
38
|
+
*/
|
|
39
|
+
protected readonly _focusables: ViewCollection<FocusableView>;
|
|
40
|
+
/**
|
|
41
|
+
* Helps cycling over {@link #_focusables} in the form.
|
|
42
|
+
*/
|
|
43
|
+
protected readonly _focusCycler: FocusCycler;
|
|
44
|
+
/**
|
|
45
|
+
* @inheritDoc
|
|
46
|
+
*/
|
|
47
|
+
constructor(locale: Locale);
|
|
48
|
+
/**
|
|
49
|
+
* @inheritDoc
|
|
50
|
+
*/
|
|
51
|
+
render(): void;
|
|
52
|
+
/**
|
|
53
|
+
* @inheritDoc
|
|
54
|
+
*/
|
|
55
|
+
destroy(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Creates the button view.
|
|
58
|
+
*
|
|
59
|
+
* @param label The button label
|
|
60
|
+
* @param icon The button's icon.
|
|
61
|
+
* @param className The additional button CSS class name.
|
|
62
|
+
* @param eventName The event name that the ButtonView#execute event will be delegated to.
|
|
63
|
+
* @returns The button view instance.
|
|
64
|
+
*/
|
|
65
|
+
private _createButton;
|
|
66
|
+
/**
|
|
67
|
+
* Creates an input with a label.
|
|
68
|
+
*
|
|
69
|
+
* @returns Labeled field view instance.
|
|
70
|
+
*/
|
|
71
|
+
private _createLabeledInputView;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Fired when the form view is submitted.
|
|
75
|
+
*
|
|
76
|
+
* @eventName ~TextAlternativeFormView#submit
|
|
77
|
+
*/
|
|
78
|
+
export type TextAlternativeFormViewSubmitEvent = {
|
|
79
|
+
name: 'submit';
|
|
80
|
+
args: [];
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Fired when the form view is canceled.
|
|
84
|
+
*
|
|
85
|
+
* @eventName ~TextAlternativeFormView#cancel
|
|
86
|
+
*/
|
|
87
|
+
export type TextAlternativeFormViewCancelEvent = {
|
|
88
|
+
name: 'cancel';
|
|
89
|
+
args: [];
|
|
90
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
* @module image/imagetextalternative
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import ImageTextAlternativeEditing from './imagetextalternative/imagetextalternativeediting.js';
|
|
10
|
+
import ImageTextAlternativeUI from './imagetextalternative/imagetextalternativeui.js';
|
|
11
|
+
/**
|
|
12
|
+
* The image text alternative plugin.
|
|
13
|
+
*
|
|
14
|
+
* For a detailed overview, check the {@glink features/images/images-styles image styles} documentation.
|
|
15
|
+
*
|
|
16
|
+
* This is a "glue" plugin which loads the
|
|
17
|
+
* {@link module:image/imagetextalternative/imagetextalternativeediting~ImageTextAlternativeEditing}
|
|
18
|
+
* and {@link module:image/imagetextalternative/imagetextalternativeui~ImageTextAlternativeUI} plugins.
|
|
19
|
+
*/
|
|
20
|
+
export default class ImageTextAlternative extends Plugin {
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
static get requires(): readonly [typeof ImageTextAlternativeEditing, typeof ImageTextAlternativeUI];
|
|
25
|
+
/**
|
|
26
|
+
* @inheritDoc
|
|
27
|
+
*/
|
|
28
|
+
static get pluginName(): "ImageTextAlternative";
|
|
29
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
* @module image/imagetoolbar
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
+
import { WidgetToolbarRepository } from 'ckeditor5/src/widget.js';
|
|
10
|
+
import ImageUtils from './imageutils.js';
|
|
11
|
+
/**
|
|
12
|
+
* The image toolbar plugin. It creates and manages the image toolbar (the toolbar displayed when an image is selected).
|
|
13
|
+
*
|
|
14
|
+
* For an overview, check the {@glink features/images/images-overview#image-contextual-toolbar image contextual toolbar} documentation.
|
|
15
|
+
*
|
|
16
|
+
* Instances of toolbar components (e.g. buttons) are created using the editor's
|
|
17
|
+
* {@link module:ui/componentfactory~ComponentFactory component factory}
|
|
18
|
+
* based on the {@link module:image/imageconfig~ImageConfig#toolbar `image.toolbar` configuration option}.
|
|
19
|
+
*
|
|
20
|
+
* The toolbar uses the {@link module:ui/panel/balloon/contextualballoon~ContextualBalloon}.
|
|
21
|
+
*/
|
|
22
|
+
export default class ImageToolbar extends Plugin {
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
static get requires(): readonly [typeof WidgetToolbarRepository, typeof ImageUtils];
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
static get pluginName(): "ImageToolbar";
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
34
|
+
afterInit(): void;
|
|
35
|
+
}
|