@ckeditor/ckeditor5-image 44.2.0-alpha.6 → 44.2.0-alpha.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-image",
3
- "version": "44.2.0-alpha.6",
3
+ "version": "44.2.0-alpha.7",
4
4
  "description": "Image feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,16 +13,16 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "@ckeditor/ckeditor5-clipboard": "44.2.0-alpha.6",
17
- "@ckeditor/ckeditor5-core": "44.2.0-alpha.6",
18
- "@ckeditor/ckeditor5-engine": "44.2.0-alpha.6",
19
- "@ckeditor/ckeditor5-typing": "44.2.0-alpha.6",
20
- "@ckeditor/ckeditor5-ui": "44.2.0-alpha.6",
21
- "@ckeditor/ckeditor5-undo": "44.2.0-alpha.6",
22
- "@ckeditor/ckeditor5-upload": "44.2.0-alpha.6",
23
- "@ckeditor/ckeditor5-utils": "44.2.0-alpha.6",
24
- "@ckeditor/ckeditor5-widget": "44.2.0-alpha.6",
25
- "ckeditor5": "44.2.0-alpha.6",
16
+ "@ckeditor/ckeditor5-clipboard": "44.2.0-alpha.7",
17
+ "@ckeditor/ckeditor5-core": "44.2.0-alpha.7",
18
+ "@ckeditor/ckeditor5-engine": "44.2.0-alpha.7",
19
+ "@ckeditor/ckeditor5-typing": "44.2.0-alpha.7",
20
+ "@ckeditor/ckeditor5-ui": "44.2.0-alpha.7",
21
+ "@ckeditor/ckeditor5-undo": "44.2.0-alpha.7",
22
+ "@ckeditor/ckeditor5-upload": "44.2.0-alpha.7",
23
+ "@ckeditor/ckeditor5-utils": "44.2.0-alpha.7",
24
+ "@ckeditor/ckeditor5-widget": "44.2.0-alpha.7",
25
+ "ckeditor5": "44.2.0-alpha.7",
26
26
  "lodash-es": "4.17.21"
27
27
  },
28
28
  "author": "CKSource (http://cksource.com/)",
@@ -128,6 +128,12 @@ export default class ImageSizeAttributes extends Plugin {
128
128
  else {
129
129
  viewWriter.removeAttribute(viewAttributeName, img);
130
130
  }
131
+ const width = data.item.getAttribute('width');
132
+ const height = data.item.getAttribute('height');
133
+ const hasSizes = width && height;
134
+ if (hasSizes && isEditingDowncast) {
135
+ viewWriter.setAttribute('loading', 'lazy', img);
136
+ }
131
137
  // Do not set aspect-ratio for pictures. See https://github.com/ckeditor/ckeditor5/issues/14579.
132
138
  if (data.item.hasAttribute('sources')) {
133
139
  return;
@@ -137,14 +143,8 @@ export default class ImageSizeAttributes extends Plugin {
137
143
  if (imageType === 'imageInline' && !isResized && !setRatioForInlineImage) {
138
144
  return;
139
145
  }
140
- const width = data.item.getAttribute('width');
141
- const height = data.item.getAttribute('height');
142
- if (!width || !height) {
143
- return;
144
- }
145
- viewWriter.setStyle('aspect-ratio', `${width}/${height}`, img);
146
- if (isEditingDowncast) {
147
- viewWriter.setAttribute('loading', 'lazy', img);
146
+ if (hasSizes) {
147
+ viewWriter.setStyle('aspect-ratio', `${width}/${height}`, img);
148
148
  }
149
149
  });
150
150
  }