File tree 2 files changed +19
-2
lines changed 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @programmer_network/yail" ,
3
- "version" : " 1.0.193 " ,
3
+ "version" : " 1.0.194 " ,
4
4
"description" : " Programmer Network's official UI library for React" ,
5
5
"author" : " Aleksandar Grbic - (https://programmer.network)" ,
6
6
"publishConfig" : {
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ const ImageCrop: FC<IImageCropProps> = ({
30
30
const [ scale ] = useState ( 1 ) ;
31
31
const [ rotate ] = useState ( 0 ) ;
32
32
33
- const onImageLoad = ( e : React . SyntheticEvent < HTMLImageElement > ) => {
33
+ const onImageLoad = async ( e : React . SyntheticEvent < HTMLImageElement > ) => {
34
34
if ( ! aspect ) {
35
35
return ;
36
36
}
@@ -52,6 +52,23 @@ const ImageCrop: FC<IImageCropProps> = ({
52
52
mediaHeight
53
53
)
54
54
) ;
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 ) ;
55
72
} ;
56
73
57
74
const handleChange = ( _ : PixelCrop , percentCrop : PercentCrop ) => {
You can’t perform that action at this time.
0 commit comments