From aa9ad3f0455520f3e0aa6104772ada6c38ffbc07 Mon Sep 17 00:00:00 2001
From: pqcqaq <905739777@qq.com>
Date: Wed, 16 Oct 2024 00:19:05 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=BC=A0=E6=97=B6?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../console/essay/editor/web.pc.tsx | 109 ++++++++++++------
1 file changed, 73 insertions(+), 36 deletions(-)
diff --git a/src/components/console/essay/editor/web.pc.tsx b/src/components/console/essay/editor/web.pc.tsx
index ba5a726..5ecafa7 100644
--- a/src/components/console/essay/editor/web.pc.tsx
+++ b/src/components/console/essay/editor/web.pc.tsx
@@ -121,22 +121,57 @@ export default function VditorComponent(
>
{t('common::action.cancel')}
- {
- if (!item?.title) {
- message.error(
- t('error.titleCannotBeEmpty')
- );
- return;
- }
- setShowTitleEdit(false);
- execute();
- navigateBack();
- }}
- executeText={t('common::action.save')}
- >
+ {/* 如果没有被commit,是没有实际记录,所以无法关联到file,就无法点击 */}
+ {isCreation ? (
+
+ ) : (
+ {
+ if (!item.content) {
+ message.error(
+ t('error.contentCannotBeEmpty')
+ );
+ return false;
+ }
+ if (!item?.title) {
+ message.error(
+ t('error.titleCannotBeEmpty')
+ );
+ return false;
+ }
+ return true;
+ }}
+ afterCommit={() => {
+ setShowTitleEdit(false);
+ execute();
+ navigateBack();
+ }}
+ executeText={t('common::action.save')}
+ >
+ )}
}
>
@@ -152,26 +187,28 @@ export default function VditorComponent(
/>
-
+ {item && (
+
+ )}