fix:图片裁剪时优先原格式

This commit is contained in:
hezhihang 2024-11-06 20:12:16 +08:00
parent 7c7e5a0034
commit 9c3534dad8

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
);
}