瀏覽代碼

Internal: use a custom aspect ratio function to promote ratio based on a image's natural width/height.

Marek Lewandowski 6 年之前
父節點
當前提交
a791f9d964
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      packages/ckeditor5-image/src/image/imageediting.js

+ 3 - 0
packages/ckeditor5-image/src/image/imageediting.js

@@ -65,6 +65,9 @@ export default class ImageEditing extends Plugin {
 				editor.plugins.get( 'WidgetResizer' ).apply( ret, viewWriter, {
 					getResizeHost( wrapper ) {
 						return wrapper.querySelector( 'img' );
+					},
+					getAspectRatio( resizeHost ) {
+						return resizeHost.naturalWidth / resizeHost.naturalHeight;
 					}
 				} );