From 0b9d16e8f1d0b167c513d63d4cfa755eea4be2d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Wed, 16 Sep 2026 13:18:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B6=A6=E8=89=B2=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=97=A0=E6=B3=95=E6=84=9F=E7=9F=A5=E8=BE=93=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 用 React 状态同步编辑器当前文本 - 让按钮禁用态随用户输入即时更新 --- .../features/project-workspace/ResourceReferenceInput.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx b/apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx index d8354c565..72524200e 100644 --- a/apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx +++ b/apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx @@ -763,6 +763,7 @@ function ResourceReferenceEditor({ references: initialDraft?.references ?? [], content: [], }); + const [draftText, setDraftText] = useState(initialDraft?.text ?? ''); const reminderDisabledRef = useRef(reminderDisabled); reminderDisabledRef.current = reminderDisabled; @@ -1007,9 +1008,7 @@ function ResourceReferenceEditor({ aria-label="AI 润色" title="AI 润色" aria-busy={polishing} - disabled={ - disabled || polishing || liveDraftRef.current.text.trim() === '' - } + disabled={disabled || polishing || draftText.trim() === ''} onMouseDown={(event) => event.preventDefault()} onClick={() => void polishPrompt()} > @@ -1215,6 +1214,7 @@ function ResourceReferenceEditor({ onChange={(editorState) => { const nextDraft = readResourceReferenceDraft(editorState); liveDraftRef.current = nextDraft; + setDraftText(nextDraft.text); if (skipInitialDraftChangeRef.current) { skipInitialDraftChangeRef.current = false; return;