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) }