diff --git a/components/ui/edit-modal.tsx b/components/ui/edit-modal.tsx index 47c573b..613689a 100644 --- a/components/ui/edit-modal.tsx +++ b/components/ui/edit-modal.tsx @@ -117,9 +117,6 @@ const [pendingSwitchTabId, setPendingSwitchTabId] = useState(null // 切换前 检查是否更新 const isUpdate = checkUpdate(tabId); if (isUpdate) { - // setPendingSwitchTabId(tabId); // 记录要切换到的目标tab - // setRemindFallbackText('You must click Apply button to save the current changes.'); - // setIsRemindFallbackOpen(true); return; } setActiveTab(tabId); @@ -129,8 +126,12 @@ const [pendingSwitchTabId, setPendingSwitchTabId] = useState(null const handleSave = () => { console.log('handleSave'); // setIsRemindFallbackOpen(true); - if (activeTab === '1') { + if (activeTab === '0') { + scriptTabContentRef.current.saveBefore(); + } else if (activeTab === '1') { characterTabContentRef.current.saveBefore(); + } else if (activeTab === '3') { + handleConfirmGotoFallback(); } } diff --git a/components/ui/script-tab-content.tsx b/components/ui/script-tab-content.tsx index 6b8b86f..c347006 100644 --- a/components/ui/script-tab-content.tsx +++ b/components/ui/script-tab-content.tsx @@ -15,7 +15,7 @@ interface ScriptTabContentProps { } export const ScriptTabContent = forwardRef< - { switchBefore: (tabId: string) => boolean }, + { switchBefore: (tabId: string) => boolean, saveBefore: () => void }, ScriptTabContentProps >((props, ref) => { const { setIsPauseWorkFlow, isPauseWorkFlow, originalText, onApply, setActiveTab } = props; @@ -39,6 +39,12 @@ export const ScriptTabContent = forwardRef< } return isUpdate; }, + saveBefore: () => { + console.log('saveBefore'); + if (isUpdate) { + onApply(); + } + } })); const handleApply = () => {