@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.
Files changed (71) hide show
  1. package/build/image.js +1 -1
  2. package/dist/content-index.css +105 -0
  3. package/dist/editor-index.css +108 -0
  4. package/dist/index.css +462 -0
  5. package/dist/index.css.map +1 -0
  6. package/dist/index.js +5860 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/types/augmentation.d.ts +56 -0
  9. package/dist/types/autoimage.d.ts +52 -0
  10. package/dist/types/image/converters.d.ts +66 -0
  11. package/dist/types/image/imageblockediting.d.ts +59 -0
  12. package/dist/types/image/imageediting.d.ts +30 -0
  13. package/dist/types/image/imageinlineediting.d.ts +60 -0
  14. package/dist/types/image/imageloadobserver.d.ts +48 -0
  15. package/dist/types/image/imageplaceholder.d.ts +39 -0
  16. package/dist/types/image/imagetypecommand.d.ts +44 -0
  17. package/dist/types/image/insertimagecommand.d.ts +66 -0
  18. package/dist/types/image/replaceimagesourcecommand.d.ts +51 -0
  19. package/dist/types/image/ui/utils.d.ts +25 -0
  20. package/dist/types/image/utils.d.ts +64 -0
  21. package/dist/types/image.d.ts +34 -0
  22. package/dist/types/imageblock.d.ts +34 -0
  23. package/dist/types/imagecaption/imagecaptionediting.d.ts +89 -0
  24. package/dist/types/imagecaption/imagecaptionui.d.ts +26 -0
  25. package/dist/types/imagecaption/imagecaptionutils.d.ts +38 -0
  26. package/dist/types/imagecaption/toggleimagecaptioncommand.d.ts +66 -0
  27. package/dist/types/imagecaption.d.ts +26 -0
  28. package/dist/types/imageconfig.d.ts +712 -0
  29. package/dist/types/imageinline.d.ts +34 -0
  30. package/dist/types/imageinsert/imageinsertui.d.ts +74 -0
  31. package/dist/types/imageinsert/imageinsertviaurlui.d.ts +44 -0
  32. package/dist/types/imageinsert/ui/imageinsertformview.d.ts +56 -0
  33. package/dist/types/imageinsert/ui/imageinserturlview.d.ts +107 -0
  34. package/dist/types/imageinsert.d.ts +33 -0
  35. package/dist/types/imageinsertviaurl.d.ts +31 -0
  36. package/dist/types/imageresize/imageresizebuttons.d.ts +67 -0
  37. package/dist/types/imageresize/imageresizeediting.d.ts +37 -0
  38. package/dist/types/imageresize/imageresizehandles.d.ts +31 -0
  39. package/dist/types/imageresize/resizeimagecommand.d.ts +42 -0
  40. package/dist/types/imageresize.d.ts +27 -0
  41. package/dist/types/imagesizeattributes.d.ts +34 -0
  42. package/dist/types/imagestyle/converters.d.ts +24 -0
  43. package/dist/types/imagestyle/imagestylecommand.d.ts +68 -0
  44. package/dist/types/imagestyle/imagestyleediting.d.ts +50 -0
  45. package/dist/types/imagestyle/imagestyleui.d.ts +56 -0
  46. package/dist/types/imagestyle/utils.d.ts +101 -0
  47. package/dist/types/imagestyle.d.ts +32 -0
  48. package/dist/types/imagetextalternative/imagetextalternativecommand.d.ts +34 -0
  49. package/dist/types/imagetextalternative/imagetextalternativeediting.d.ts +28 -0
  50. package/dist/types/imagetextalternative/imagetextalternativeui.d.ts +68 -0
  51. package/dist/types/imagetextalternative/ui/textalternativeformview.d.ts +90 -0
  52. package/dist/types/imagetextalternative.d.ts +29 -0
  53. package/dist/types/imagetoolbar.d.ts +35 -0
  54. package/dist/types/imageupload/imageuploadediting.d.ts +111 -0
  55. package/dist/types/imageupload/imageuploadprogress.d.ts +42 -0
  56. package/dist/types/imageupload/imageuploadui.d.ts +23 -0
  57. package/dist/types/imageupload/uploadimagecommand.d.ts +60 -0
  58. package/dist/types/imageupload/utils.d.ts +33 -0
  59. package/dist/types/imageupload.d.ts +32 -0
  60. package/dist/types/imageutils.d.ts +125 -0
  61. package/dist/types/index.d.ts +48 -0
  62. package/dist/types/pictureediting.d.ts +88 -0
  63. package/lang/translations/he.po +1 -1
  64. package/package.json +4 -3
  65. package/src/augmentation.d.ts +1 -1
  66. package/src/imageinsert/imageinsertui.d.ts +4 -2
  67. package/src/imageinsert/imageinsertui.js +1 -1
  68. package/src/imageinsert/imageinsertviaurlui.d.ts +1 -1
  69. package/src/imageinsert/imageinsertviaurlui.js +2 -3
  70. package/src/imageresize/imageresizehandles.js +1 -2
  71. package/src/imageupload/imageuploadui.js +1 -2
@@ -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/image
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import ImageBlock from './imageblock.js';
10
+ import ImageInline from './imageinline.js';
11
+ import '../theme/image.css';
12
+ /**
13
+ * The image plugin.
14
+ *
15
+ * For a detailed overview, check the {@glink features/images/images-overview image feature} documentation.
16
+ *
17
+ * This is a "glue" plugin which loads the following plugins:
18
+ *
19
+ * * {@link module:image/imageblock~ImageBlock},
20
+ * * {@link module:image/imageinline~ImageInline},
21
+ *
22
+ * Usually, it is used in conjunction with other plugins from this package. See the {@glink api/image package page}
23
+ * for more information.
24
+ */
25
+ export default class Image extends Plugin {
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get requires(): readonly [typeof ImageBlock, typeof ImageInline];
30
+ /**
31
+ * @inheritDoc
32
+ */
33
+ static get pluginName(): "Image";
34
+ }
@@ -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/imageblock
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { Widget } from 'ckeditor5/src/widget.js';
10
+ import ImageTextAlternative from './imagetextalternative.js';
11
+ import ImageBlockEditing from './image/imageblockediting.js';
12
+ import ImageInsertUI from './imageinsert/imageinsertui.js';
13
+ import '../theme/image.css';
14
+ /**
15
+ * The image block plugin.
16
+ *
17
+ * This is a "glue" plugin which loads the following plugins:
18
+ *
19
+ * * {@link module:image/image/imageblockediting~ImageBlockEditing},
20
+ * * {@link module:image/imagetextalternative~ImageTextAlternative}.
21
+ *
22
+ * Usually, it is used in conjunction with other plugins from this package. See the {@glink api/image package page}
23
+ * for more information.
24
+ */
25
+ export default class ImageBlock extends Plugin {
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get requires(): readonly [typeof ImageBlockEditing, typeof Widget, typeof ImageTextAlternative, typeof ImageInsertUI];
30
+ /**
31
+ * @inheritDoc
32
+ */
33
+ static get pluginName(): "ImageBlock";
34
+ }
@@ -0,0 +1,89 @@
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/imagecaption/imagecaptionediting
7
+ */
8
+ import { type Editor, Plugin } from 'ckeditor5/src/core.js';
9
+ import { Element } from 'ckeditor5/src/engine.js';
10
+ import ImageUtils from '../imageutils.js';
11
+ import ImageCaptionUtils from './imagecaptionutils.js';
12
+ /**
13
+ * The image caption engine plugin. It is responsible for:
14
+ *
15
+ * * registering converters for the caption element,
16
+ * * registering converters for the caption model attribute,
17
+ * * registering the {@link module:image/imagecaption/toggleimagecaptioncommand~ToggleImageCaptionCommand `toggleImageCaption`} command.
18
+ */
19
+ export default class ImageCaptionEditing extends Plugin {
20
+ /**
21
+ * @inheritDoc
22
+ */
23
+ static get requires(): readonly [typeof ImageUtils, typeof ImageCaptionUtils];
24
+ /**
25
+ * @inheritDoc
26
+ */
27
+ static get pluginName(): "ImageCaptionEditing";
28
+ /**
29
+ * A map that keeps saved JSONified image captions and image model elements they are
30
+ * associated with.
31
+ *
32
+ * To learn more about this system, see {@link #_saveCaption}.
33
+ */
34
+ private _savedCaptionsMap;
35
+ /**
36
+ * @inheritDoc
37
+ */
38
+ constructor(editor: Editor);
39
+ /**
40
+ * @inheritDoc
41
+ */
42
+ init(): void;
43
+ /**
44
+ * Configures conversion pipelines to support upcasting and downcasting
45
+ * image captions.
46
+ */
47
+ private _setupConversion;
48
+ /**
49
+ * Integrates with {@link module:image/image/imagetypecommand~ImageTypeCommand image type commands}
50
+ * to make sure the caption is preserved when the type of an image changes so it can be restored
51
+ * in the future if the user decides they want their caption back.
52
+ */
53
+ private _setupImageTypeCommandsIntegration;
54
+ /**
55
+ * Returns the saved {@link module:engine/model/element~Element#toJSON JSONified} caption
56
+ * of an image model element.
57
+ *
58
+ * See {@link #_saveCaption}.
59
+ *
60
+ * @internal
61
+ * @param imageModelElement The model element the caption should be returned for.
62
+ * @returns The model caption element or `null` if there is none.
63
+ */
64
+ _getSavedCaption(imageModelElement: Element): Element | null;
65
+ /**
66
+ * Saves a {@link module:engine/model/element~Element#toJSON JSONified} caption for
67
+ * an image element to allow restoring it in the future.
68
+ *
69
+ * A caption is saved every time it gets hidden and/or the type of an image changes. The
70
+ * user should be able to restore it on demand.
71
+ *
72
+ * **Note**: The caption cannot be stored in the image model element attribute because,
73
+ * for instance, when the model state propagates to collaborators, the attribute would get
74
+ * lost (mainly because it does not convert to anything when the caption is hidden) and
75
+ * the states of collaborators' models would de-synchronize causing numerous issues.
76
+ *
77
+ * See {@link #_getSavedCaption}.
78
+ *
79
+ * @internal
80
+ * @param imageModelElement The model element the caption is saved for.
81
+ * @param caption The caption model element to be saved.
82
+ */
83
+ _saveCaption(imageModelElement: Element, caption: Element): void;
84
+ /**
85
+ * Reconverts image caption when image alt attribute changes.
86
+ * The change of alt attribute is reflected in caption's aria-label attribute.
87
+ */
88
+ private _registerCaptionReconversion;
89
+ }
@@ -0,0 +1,26 @@
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/imagecaption/imagecaptionui
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import ImageCaptionUtils from './imagecaptionutils.js';
10
+ /**
11
+ * The image caption UI plugin. It introduces the `'toggleImageCaption'` UI button.
12
+ */
13
+ export default class ImageCaptionUI extends Plugin {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get requires(): readonly [typeof ImageCaptionUtils];
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get pluginName(): "ImageCaptionUI";
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ init(): void;
26
+ }
@@ -0,0 +1,38 @@
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/imagecaption/imagecaptionutils
7
+ */
8
+ import type { DocumentSelection, Element, Selection, ViewElement, Match } from 'ckeditor5/src/engine.js';
9
+ import { Plugin } from 'ckeditor5/src/core.js';
10
+ import ImageUtils from '../imageutils.js';
11
+ /**
12
+ * The image caption utilities plugin.
13
+ */
14
+ export default class ImageCaptionUtils extends Plugin {
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ static get pluginName(): "ImageCaptionUtils";
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get requires(): readonly [typeof ImageUtils];
23
+ /**
24
+ * Returns the caption model element from a given image element. Returns `null` if no caption is found.
25
+ */
26
+ getCaptionFromImageModelElement(imageModelElement: Element): Element | null;
27
+ /**
28
+ * Returns the caption model element for a model selection. Returns `null` if the selection has no caption element ancestor.
29
+ */
30
+ getCaptionFromModelSelection(selection: Selection | DocumentSelection): Element | null;
31
+ /**
32
+ * {@link module:engine/view/matcher~Matcher} pattern. Checks if a given element is a `<figcaption>` element that is placed
33
+ * inside the image `<figure>` element.
34
+ * @returns Returns the object accepted by {@link module:engine/view/matcher~Matcher} or `null` if the element
35
+ * cannot be matched.
36
+ */
37
+ matchImageCaptionViewElement(element: ViewElement): Match | null;
38
+ }
@@ -0,0 +1,66 @@
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
+ import { Command } from 'ckeditor5/src/core.js';
6
+ /**
7
+ * The toggle image caption command.
8
+ *
9
+ * This command is registered by {@link module:image/imagecaption/imagecaptionediting~ImageCaptionEditing} as the
10
+ * `'toggleImageCaption'` editor command.
11
+ *
12
+ * Executing this command:
13
+ *
14
+ * * either adds or removes the image caption of a selected image (depending on whether the caption is present or not),
15
+ * * removes the image caption if the selection is anchored in one.
16
+ *
17
+ * ```ts
18
+ * // Toggle the presence of the caption.
19
+ * editor.execute( 'toggleImageCaption' );
20
+ * ```
21
+ *
22
+ * **Note**: Upon executing this command, the selection will be set on the image if previously anchored in the caption element.
23
+ *
24
+ * **Note**: You can move the selection to the caption right away as it shows up upon executing this command by using
25
+ * the `focusCaptionOnShow` option:
26
+ *
27
+ * ```ts
28
+ * editor.execute( 'toggleImageCaption', { focusCaptionOnShow: true } );
29
+ * ```
30
+ */
31
+ export default class ToggleImageCaptionCommand extends Command {
32
+ value: boolean;
33
+ /**
34
+ * @inheritDoc
35
+ */
36
+ refresh(): void;
37
+ /**
38
+ * Executes the command.
39
+ *
40
+ * ```ts
41
+ * editor.execute( 'toggleImageCaption' );
42
+ * ```
43
+ *
44
+ * @param options Options for the executed command.
45
+ * @param options.focusCaptionOnShow When true and the caption shows up, the selection will be moved into it straight away.
46
+ * @fires execute
47
+ */
48
+ execute(options?: {
49
+ focusCaptionOnShow?: boolean;
50
+ }): void;
51
+ /**
52
+ * Shows the caption of the `<imageBlock>` or `<imageInline>`. Also:
53
+ *
54
+ * * it converts `<imageInline>` to `<imageBlock>` to show the caption,
55
+ * * it attempts to restore the caption content from the `ImageCaptionEditing` caption registry,
56
+ * * it moves the selection to the caption right away, it the `focusCaptionOnShow` option was set.
57
+ */
58
+ private _showImageCaption;
59
+ /**
60
+ * Hides the caption of a selected image (or an image caption the selection is anchored to).
61
+ *
62
+ * The content of the caption is stored in the `ImageCaptionEditing` caption registry to make this
63
+ * a reversible action.
64
+ */
65
+ private _hideImageCaption;
66
+ }
@@ -0,0 +1,26 @@
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/imagecaption
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import ImageCaptionEditing from './imagecaption/imagecaptionediting.js';
10
+ import ImageCaptionUI from './imagecaption/imagecaptionui.js';
11
+ import '../theme/imagecaption.css';
12
+ /**
13
+ * The image caption plugin.
14
+ *
15
+ * For a detailed overview, check the {@glink features/images/images-captions image caption} documentation.
16
+ */
17
+ export default class ImageCaption extends Plugin {
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ static get requires(): readonly [typeof ImageCaptionEditing, typeof ImageCaptionUI];
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get pluginName(): "ImageCaption";
26
+ }