File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @programmer_network/yail" ,
3- "version" : " 1.0.193 " ,
3+ "version" : " 1.0.194 " ,
44 "description" : " Programmer Network's official UI library for React" ,
55 "author" : " Aleksandar Grbic - (https://programmer.network)" ,
66 "publishConfig" : {
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ const ImageCrop: FC<IImageCropProps> = ({
3030 const [ scale ] = useState ( 1 ) ;
3131 const [ rotate ] = useState ( 0 ) ;
3232
33- const onImageLoad = ( e : React . SyntheticEvent < HTMLImageElement > ) => {
33+ const onImageLoad = async ( e : React . SyntheticEvent < HTMLImageElement > ) => {
3434 if ( ! aspect ) {
3535 return ;
3636 }
@@ -52,6 +52,23 @@ const ImageCrop: FC<IImageCropProps> = ({
5252 mediaHeight
5353 )
5454 ) ;
55+
56+ if ( ! imgRef . current ) {
57+ return ;
58+ }
59+
60+ const { croppedImage, cropError } = await CanvasUtils . getCroppedImg (
61+ imgRef . current ,
62+ crop
63+ ) ;
64+
65+ if ( cropError ) {
66+ onError ?.( cropError ) ;
67+
68+ return ;
69+ }
70+
71+ onComplete ?.( croppedImage as Blob ) ;
5572 } ;
5673
5774 const handleChange = ( _ : PixelCrop , percentCrop : PercentCrop ) => {
You can’t perform that action at this time.
0 commit comments