Skip to content

Commit

Permalink
Fixed errors raising in console when clicking outside MediaUploader m…
Browse files Browse the repository at this point in the history
…odal while upload in progress (#893)
  • Loading branch information
gaagul authored Sep 20, 2023
1 parent ad9fb34 commit e53d440
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/Editor/MediaUploader/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from "react";

import { Modal, Tab } from "neetoui";
import { not } from "ramda";
import { useTranslation } from "react-i18next";

import { isNilOrEmpty } from "utils/common";
Expand Down Expand Up @@ -53,8 +54,10 @@ const MediaUploader = ({ mediaUploader, onClose, editor, unsplashApiKey }) => {
return (
<Modal
closeButton={false}
isOpen={isOpen}
onClose={!isUploading && handleClose}
{...{ isOpen }}
closeOnEsc={not(isUploading)}
closeOnOutsideClick={not(isUploading)}
onClose={handleClose}
>
<div className="ne-media-uploader">
{!isNilOrEmpty(tabs) && (
Expand All @@ -73,9 +76,8 @@ const MediaUploader = ({ mediaUploader, onClose, editor, unsplashApiKey }) => {
<div className="ne-media-uploader__content">
{activeTab === "local" && (
<LocalUploader
insertMediaToEditor={insertMediaToEditor}
{...{ insertMediaToEditor, setIsUploading }}
isImage={mediaUploader.image}
setIsUploading={setIsUploading}
onClose={handleClose}
/>
)}
Expand All @@ -90,7 +92,7 @@ const MediaUploader = ({ mediaUploader, onClose, editor, unsplashApiKey }) => {
)}
{activeTab === "unsplash" && (
<UnsplashImagePicker
unsplashApiKey={unsplashApiKey}
{...{ unsplashApiKey }}
onSubmit={handleSubmit}
/>
)}
Expand Down

0 comments on commit e53d440

Please sign in to comment.