From 00f58fd08e6a62e887a1d66d2c565dfb737d41eb Mon Sep 17 00:00:00 2001 From: Calvin Lee Date: Mon, 25 Mar 2024 00:02:27 +0000 Subject: [PATCH] fix: [code-1663]: add error message on submit btn (#1136) --- .../MarkdownEditorWithPreview.tsx | 8 ++++++-- web/src/framework/strings/stringTypes.ts | 1 + web/src/i18n/strings.en.yaml | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/web/src/components/MarkdownEditorWithPreview/MarkdownEditorWithPreview.tsx b/web/src/components/MarkdownEditorWithPreview/MarkdownEditorWithPreview.tsx index a6053e14c..a20e2cfb1 100644 --- a/web/src/components/MarkdownEditorWithPreview/MarkdownEditorWithPreview.tsx +++ b/web/src/components/MarkdownEditorWithPreview/MarkdownEditorWithPreview.tsx @@ -478,8 +478,12 @@ export function MarkdownEditorWithPreview({ variation={ButtonVariation.PRIMARY} disabled={false} onClick={() => { - handleUpload(file as File, setMarkdownContent, repoMetadata, showError, standalone, routingId) - setOpen(false) + if (file !== undefined) { + handleUpload(file as File, setMarkdownContent, repoMetadata, showError, standalone, routingId) + setOpen(false) + } else { + showError(getString('uploadAFileError')) + } }} />