@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/build/image.js +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/src/imagesizeattributes.js +8 -8
package/dist/index.js
CHANGED
|
@@ -1620,6 +1620,12 @@ const IMAGE_URL_REGEXP = new RegExp(String(/^(http(s)?:\/\/)?[\w-]+\.[\w.~:/[\]@
|
|
|
1620
1620
|
} else {
|
|
1621
1621
|
viewWriter.removeAttribute(viewAttributeName, img);
|
|
1622
1622
|
}
|
|
1623
|
+
const width = data.item.getAttribute('width');
|
|
1624
|
+
const height = data.item.getAttribute('height');
|
|
1625
|
+
const hasSizes = width && height;
|
|
1626
|
+
if (hasSizes && isEditingDowncast) {
|
|
1627
|
+
viewWriter.setAttribute('loading', 'lazy', img);
|
|
1628
|
+
}
|
|
1623
1629
|
// Do not set aspect-ratio for pictures. See https://github.com/ckeditor/ckeditor5/issues/14579.
|
|
1624
1630
|
if (data.item.hasAttribute('sources')) {
|
|
1625
1631
|
return;
|
|
@@ -1629,14 +1635,8 @@ const IMAGE_URL_REGEXP = new RegExp(String(/^(http(s)?:\/\/)?[\w-]+\.[\w.~:/[\]@
|
|
|
1629
1635
|
if (imageType === 'imageInline' && !isResized && !setRatioForInlineImage) {
|
|
1630
1636
|
return;
|
|
1631
1637
|
}
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
if (!width || !height) {
|
|
1635
|
-
return;
|
|
1636
|
-
}
|
|
1637
|
-
viewWriter.setStyle('aspect-ratio', `${width}/${height}`, img);
|
|
1638
|
-
if (isEditingDowncast) {
|
|
1639
|
-
viewWriter.setAttribute('loading', 'lazy', img);
|
|
1638
|
+
if (hasSizes) {
|
|
1639
|
+
viewWriter.setStyle('aspect-ratio', `${width}/${height}`, img);
|
|
1640
1640
|
}
|
|
1641
1641
|
});
|
|
1642
1642
|
}
|