Merge pull request #11170 from hzh11012/310-6.8.0-1

fix:图片裁剪时优先原格式
This commit is contained in:
Allen 2024-11-07 17:34:58 +08:00 committed by GitHub
commit aad00bb919
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() { handleCrop() {
const {cropFormat, cropQuality} = this.props; const {cropFormat, cropQuality} = this.props;
const originFormat = this.state.cropFile?.type || 'image/png';
this.cropper.getCroppedCanvas().toBlob( this.cropper.getCroppedCanvas().toBlob(
(file: File) => { (file: File) => {
this.addFiles([file]); this.addFiles([file]);
@ -1116,7 +1117,7 @@ export default class ImageControl extends React.Component<
lockedReason: '' lockedReason: ''
}); });
}, },
cropFormat || 'image/png', cropFormat || originFormat,
cropQuality || 1 cropQuality || 1
); );
} }