const img = evt.target.files[0];
if (!img) return;
setImgFile(img);
+ shortcodeRef.current.value = img.name.slice(0, img.name.indexOf('.'));
shortcodeRef.current.focus();
};
const handleRemove = () => {
setImgFile(null);
inputRef.current.value = null;
+ shortcodeRef.current.value = '';
};
return (
img.onload = () => {
let newWidth = img.width;
let newHeight = img.height;
+ if (newHeight <= height && newWidth <= width) {
+ resolve(imageFile);
+ }
if (newHeight > height) {
newWidth = Math.floor(newWidth * (height / newHeight));