Skip to content

Commit fec9397

Browse files
committed
Fix: image upload warning
1 parent b0d9fb9 commit fec9397

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/controls/image.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ const ImageControls = ({ options: { maxImageSize = 1024000 } = {} }: IImageContr
2020
const f = e.target.files[0];
2121
if (!f) return;
2222
if (f.size > maxImageSize) {
23-
const kb = maxImageSize / 1024;
24-
window.toast.warning(`Image size should be less than ${kb > 1024 ? `${kb / 1024} MB` : `${kb} KB`}`);
23+
const kb = +(maxImageSize / 1024).toFixed(0);
24+
window.toast.warning(`Image size should be less than ${kb > 1024 ? `${(kb / 1024).toFixed(0)} MB` : `${kb} KB`}`);
25+
e.target.value = "";
2526
return;
2627
}
2728
setFile(await toBase64(f));

0 commit comments

Comments
 (0)