From 6a255ed6a9408f14f4798fe2b624907df20c4b1a Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Fri, 19 Mar 2021 09:13:35 +0800
Subject: fix: Disable markdown send when text is empty.

---
 FrontEnd/src/app/views/timeline-common/MarkdownPostEdit.tsx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'FrontEnd/src/app/views/timeline-common/MarkdownPostEdit.tsx')

diff --git a/FrontEnd/src/app/views/timeline-common/MarkdownPostEdit.tsx b/FrontEnd/src/app/views/timeline-common/MarkdownPostEdit.tsx
index f30e960b..ac4baae8 100644
--- a/FrontEnd/src/app/views/timeline-common/MarkdownPostEdit.tsx
+++ b/FrontEnd/src/app/views/timeline-common/MarkdownPostEdit.tsx
@@ -60,6 +60,8 @@ const MarkdownPostEdit: React.FC<MarkdownPostEditProps> = ({
     return _builder.current;
   };
 
+  const canSend = text.length > 0;
+
   React.useEffect(() => {
     return () => {
       getBuilder().dispose();
@@ -118,7 +120,7 @@ const MarkdownPostEdit: React.FC<MarkdownPostEditProps> = ({
               >
                 {t("operationDialog.cancel")}
               </FlatButton>
-              <FlatButton onClick={send} disabled={canLeave}>
+              <FlatButton onClick={send} disabled={!canSend}>
                 {t("timeline.send")}
               </FlatButton>
             </>
-- 
cgit v1.2.3

