Merge pull request #11165 from hzh11012/master-image

fix:图片裁剪时优先原格式
This commit is contained in:
hsm-lv 2024-11-07 16:12:34 +08:00 committed by GitHub
commit 56ced5fe41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1107,6 +1107,7 @@ export default class ImageControl extends React.Component<
handleCrop() {
const {cropFormat, cropQuality} = this.props;
const originFormat = this.state.cropFile?.type || 'image/png';
this.cropper.getCroppedCanvas().toBlob(
(file: File) => {
this.addFiles([file]);
@ -1116,7 +1117,7 @@ export default class ImageControl extends React.Component<
lockedReason: ''
});
},
cropFormat || 'image/png',
cropFormat || originFormat,
cropQuality || 1
);
}