diff --git a/src/Components/Common/MarkdownEditor.tsx b/src/Components/Common/MarkdownEditor.tsx index 3e2a63fae6e..5e0ed692e44 100644 --- a/src/Components/Common/MarkdownEditor.tsx +++ b/src/Components/Common/MarkdownEditor.tsx @@ -8,7 +8,9 @@ import { FaUnlink, FaStrikethrough, FaQuoteRight, + FaFile, } from "react-icons/fa"; +import { RxCross2 } from "react-icons/rx"; import { GoMention } from "react-icons/go"; import { MdAttachFile } from "react-icons/md"; import TurndownService from "turndown"; @@ -88,6 +90,11 @@ const RichTextEditor: React.FC = () => { const [file, setFile] = useState(null); const [uploadFileName, setUploadFileName] = useState(""); + const fileInputRef = useRef(null); + + const triggerFileInput = () => { + fileInputRef.current?.click(); + }; useEffect(() => { document.addEventListener("selectionchange", handleSelectionChange); @@ -368,10 +375,10 @@ const RichTextEditor: React.FC = () => { }; return ( -
+
-
-
+
+
- +
@@ -742,17 +754,46 @@ const FileUpload = ({ fixedWidth={false} className="h-[80vh] w-full md:h-screen" /> +
+ {isLoading ? ( +

Loading...

+ ) : ( + <> + {files.map((file) => ( +
+ +
loadFile(file.id!)} + > + + + {file.name} + +
+
+ ))} + + )} +
-
-

Note Id:

- setNoteId(e.target.value)} - /> -
)} -
-
-

Uploaded Files:

-
- {isLoading ? ( -

Loading...

- ) : ( - <> -
- {files.map((file) => ( -
-

{file.name}

- - -
- ))} -
- - )} +
+

Note Id:

+ setNoteId(e.target.value)} + />