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/converters
|
7 | */
|
8 | import type { DowncastDispatcher, UpcastDispatcher } from 'ckeditor5/src/engine.js';
|
9 | import type ImageUtils from '../imageutils.js';
|
10 | /**
|
11 | * Returns a function that converts the image view representation:
|
12 | *
|
13 | * ```html
|
14 | * <figure class="image"><img src="..." alt="..."></img></figure>
|
15 | * ```
|
16 | *
|
17 | * to the model representation:
|
18 | *
|
19 | * ```html
|
20 | * <imageBlock src="..." alt="..."></imageBlock>
|
21 | * ```
|
22 | *
|
23 | * The entire content of the `<figure>` element except the first `<img>` is being converted as children
|
24 | * of the `<imageBlock>` model element.
|
25 | *
|
26 | * @internal
|
27 | */
|
28 | export declare function upcastImageFigure(imageUtils: ImageUtils): (dispatcher: UpcastDispatcher) => void;
|
29 | /**
|
30 | * Returns a function that converts the image view representation:
|
31 | *
|
32 | * ```html
|
33 | * <picture><source ... /><source ... />...<img ... /></picture>
|
34 | * ```
|
35 | *
|
36 | * to the model representation as the `sources` attribute:
|
37 | *
|
38 | * ```html
|
39 | * <image[Block|Inline] ... sources="..."></image[Block|Inline]>
|
40 | * ```
|
41 | *
|
42 | * @internal
|
43 | */
|
44 | export declare function upcastPicture(imageUtils: ImageUtils): (dispatcher: UpcastDispatcher) => void;
|
45 | /**
|
46 | * Converter used to convert the `srcset` model image attribute to the `srcset` and `sizes` attributes in the view.
|
47 | *
|
48 | * @internal
|
49 | * @param imageType The type of the image.
|
50 | */
|
51 | export declare function downcastSrcsetAttribute(imageUtils: ImageUtils, imageType: 'imageBlock' | 'imageInline'): (dispatcher: DowncastDispatcher) => void;
|
52 | /**
|
53 | * Converts the `source` model attribute to the `<picture><source /><source />...<img /></picture>`
|
54 | * view structure.
|
55 | *
|
56 | * @internal
|
57 | */
|
58 | export declare function downcastSourcesAttribute(imageUtils: ImageUtils): (dispatcher: DowncastDispatcher) => void;
|
59 | /**
|
60 | * Converter used to convert a given image attribute from the model to the view.
|
61 | *
|
62 | * @internal
|
63 | * @param imageType The type of the image.
|
64 | * @param attributeKey The name of the attribute to convert.
|
65 | */
|
66 | export declare function downcastImageAttribute(imageUtils: ImageUtils, imageType: 'imageBlock' | 'imageInline', attributeKey: string): (dispatcher: DowncastDispatcher) => void;
|