From 4ed9450c02d204897483f4ecb5f3dfced30d1143 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Thu, 22 Oct 2026 20:41:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E6=94=B9=E8=BF=87=E8=BE=93=E5=85=A5=E6=A1=86=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=86=8D=E6=8A=8A=E6=96=87=E5=AD=97=E8=AE=BE?= =?UTF-8?q?=E5=9B=9E=E5=8E=9F=E5=80=BC=E6=97=B6=E8=BE=93=E5=85=A5=E6=A1=86?= =?UTF-8?q?=E4=B8=8D=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 浏览器把用户输入发给运行器时没有同步更新自己记下的 Text,运行器再设成同样的值时, 属性看起来没变,输入框不会刷新。现在发送输入时同步记下(文本框、可输入的下拉框); 评分驱动做同样处理。 Co-Authored-By: Claude Opus 5.5 --- server/src/grading/driver.ts | 2 ++ web/src/run/session.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/server/src/grading/driver.ts b/server/src/grading/driver.ts index d43a377..b54ab77 100644 --- a/server/src/grading/driver.ts +++ b/server/src/grading/driver.ts @@ -129,6 +129,8 @@ export class ProgramDriver { } act(node: ControlNode, action: UserAction) { + // 和浏览器一样同步记下输入的文字(运行器不回传) + if (action.action === 'text') node.props.Text = action.value this.send({ type: 'action', id: node.id, ...action }) } diff --git a/web/src/run/session.ts b/web/src/run/session.ts index df0f2ca..f4e6e45 100644 --- a/web/src/run/session.ts +++ b/web/src/run/session.ts @@ -95,6 +95,11 @@ export function createRunSession() { function act(id: string, action: UserAction) { actionSentAt = performance.now() + // 输入的文字运行器不再回传,这里同步记下;否则程序再把 Text 设成原来的值时,属性"没变",输入框不会刷新 + if (action.action === 'text') { + const node = nodes.get(id) + if (node) node.props.Text = action.value + } send({ type: 'action', id, ...action } as ClientMessage) }