Renamed nullable utils into isDefined and isUndefinedOrNull (#4402)
* Renamed nullable utils into isDefined and isUndefinedOrNull
This commit is contained in:
@ -12,8 +12,8 @@ import { isNonEmptyString } from '@sniptt/guards';
|
||||
|
||||
import { Button } from '@/ui/input/button/components/Button';
|
||||
import { AppThemeProvider } from '@/ui/theme/components/AppThemeProvider';
|
||||
import { isNonNullable } from '~/utils/isNonNullable';
|
||||
import { isNullable } from '~/utils/isNullable';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||
|
||||
import { AttachmentIcon } from '../files/components/AttachmentIcon';
|
||||
import { AttachmentType } from '../files/types/Attachment';
|
||||
@ -80,7 +80,7 @@ const FileBlockRenderer = ({
|
||||
const inputFileRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const handleUploadAttachment = async (file: File) => {
|
||||
if (isNullable(file)) {
|
||||
if (isUndefinedOrNull(file)) {
|
||||
return '';
|
||||
}
|
||||
const fileUrl = await editor.uploadFile?.(file);
|
||||
@ -96,8 +96,7 @@ const FileBlockRenderer = ({
|
||||
inputFileRef?.current?.click?.();
|
||||
};
|
||||
const handleFileChange = (e: ChangeEvent<HTMLInputElement>) => {
|
||||
if (isNonNullable(e.target.files))
|
||||
handleUploadAttachment?.(e.target.files[0]);
|
||||
if (isDefined(e.target.files)) handleUploadAttachment?.(e.target.files[0]);
|
||||
};
|
||||
|
||||
if (isNonEmptyString(block.props.url)) {
|
||||
|
||||
Reference in New Issue
Block a user