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 && ( + + )}