diff --git a/packages/ckeditor5-image/src/imageresize/imageresizeediting.ts b/packages/ckeditor5-image/src/imageresize/imageresizeediting.ts index 7cc6700c50a..018a0063f58 100644 --- a/packages/ckeditor5-image/src/imageresize/imageresizeediting.ts +++ b/packages/ckeditor5-image/src/imageresize/imageresizeediting.ts @@ -179,6 +179,10 @@ export default class ImageResizeEditing extends Plugin { return null; } + if ( heightStyle ) { + return null; + } + return viewElement.getStyle( 'height' ); } } diff --git a/packages/ckeditor5-image/src/imagesizeattributes.ts b/packages/ckeditor5-image/src/imagesizeattributes.ts index c438e2eb72a..edaf12d5cfc 100644 --- a/packages/ckeditor5-image/src/imagesizeattributes.ts +++ b/packages/ckeditor5-image/src/imagesizeattributes.ts @@ -110,6 +110,15 @@ export default class ImageSizeAttributes extends Plugin { return heightStyle; } + const img = imageUtils.findViewImgElement( viewElement )!; + const imgHasAttributes = img.getAttribute( 'width' ) || img.getAttribute( 'height' ); + + if ( heightStyle && !viewElement.getStyle( 'width' ) ) { + if ( !imgHasAttributes ) { + return heightStyle; + } + } + return null; } }