Skip to content

Commit 6398020

Browse files
authored
Merge pull request #15277 from ckeditor/ck/15010-add-html-changes-in-images-to-migration-guide
Docs: Added HTML markups to show changes in images in the migration guide to v40. Closes #15010.
2 parents 49d2eb6 + cf6a37c commit 6398020

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

docs/updating/update-to-40.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,38 @@ This release introduces changes to the {@link features/images-overview image fea
3232
* Changes to an image (such as resize, etc.) will trigger the creation of those attributes. These attributes are crucial to proper content handling, and actions on a current image that does not have these improve this image's markup.
3333
* The `aspect-ratio` attribute has been added to the image's properties to handle situations when the file is resized or scaled with a tweaked aspect ratio.
3434

35+
Image output HTML before:
36+
37+
```html
38+
<p>
39+
<img src="image.jpg" alt="">
40+
</p>
41+
```
42+
43+
Image output HTML after (added the `width` and `height` attributes):
44+
45+
```html
46+
<p>
47+
<img src="image.jpg" alt="" width="400" height="300">
48+
</p>
49+
```
50+
51+
Resized image output HTML before:
52+
53+
```html
54+
<p>
55+
<img class="image_resized" style="width:50%;" src="image.jpg" alt="">
56+
</p>
57+
```
58+
59+
Resized image output HTML after (added the `aspect-ratio` style and the `width` and `height` attributes):
60+
61+
```html
62+
<p>
63+
<img class="image_resized" style="aspect-ratio:400/300;width:50%;" src="image.jpg" alt="" width="400" height="300">
64+
</p>
65+
```
66+
3567
#### Changes to the model
3668

3769
Due to the introduction of this new behavior, the following changes to model attributes have been introduced:
@@ -46,13 +78,37 @@ Therefore, the relation between styles and attributes toward model attributes lo
4678
* Attribute `width` → model `width` (new).
4779
* Attribute `height` → model `height` (new).
4880

81+
Given the following input HTML:
82+
83+
```html
84+
<p>
85+
<img src="image.jpg" style="width:50%;" width="400" height="300" alt="">
86+
</p>
87+
```
88+
89+
Previously, the model would set the resized value in the `width` model attribute and ignore the input `width` and `height` attributes:
90+
91+
```html
92+
<paragraph>
93+
<imageInline src="image.jpg" width="50%"></imageInline>
94+
</paragraph>
95+
```
96+
97+
And now the resized value is stored in the `resizedWidth` attribute (the `width` attribute is now reserved for the natural width value):
98+
99+
```html
100+
<paragraph>
101+
<imageInline src="image.jpg" resizedWidth="50%" width="400" height="300"></imageInline>
102+
</paragraph>
103+
```
104+
49105
#### Changes to the `srcset` attribute
50106

51107
The `srcset` model attribute which provides parameters for responsive images, has been simplified. It is no longer an object `{ data: "...", width: "..." }`, but the value that was previously stored in the `data` part.
52108

53109
#### Changes to content styles
54110

55-
Last but not least, content styles have been updated with this release, which means you need to update them in your editor implementation to avoid any discrepancies. Please refer to the {@link installation/advanced/content-styles Content styles} guide to learn how to generate the stylesheet.
111+
Last but not least, content styles have been updated with this release, which means you need to update them in your editor implementation to avoid any discrepancies. Please refer to the {@link installation/advanced/content-styles Content styles} guide to learn how to generate the style sheet.
56112

57113
### Changes to the comments feature
58114

0 commit comments

Comments
 (0)