diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/InputTypes/Code.tsx | 2 | ||||
-rw-r--r-- | src/components/Question.tsx | 16 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/components/InputTypes/Code.tsx b/src/components/InputTypes/Code.tsx index 506e181..8b2abd9 100644 --- a/src/components/InputTypes/Code.tsx +++ b/src/components/InputTypes/Code.tsx @@ -2,7 +2,7 @@ import { jsx, css } from "@emotion/react"; import React, { useEffect } from "react"; -import { basicSetup } from "@codemirror/basic-setup"; +import { basicSetup } from "codemirror"; import { python } from "@codemirror/lang-python"; import { EditorState } from "@codemirror/state"; import { oneDark } from "@codemirror/theme-one-dark"; diff --git a/src/components/Question.tsx b/src/components/Question.tsx index ebacb4a..61e66e0 100644 --- a/src/components/Question.tsx +++ b/src/components/Question.tsx @@ -35,14 +35,22 @@ class RenderedQuestion extends React.Component<QuestionProp> { } this.blurHandler = this.blurHandler.bind(this); - this.setPublicState("valid", true); - this.setPublicState("error", ""); + const _state: {[key: string]: string | boolean | null} = { + "valid": true, + "error": "", + }; + if (props.question.type === QuestionType.Code) { - this.setPublicState("unittestsFailed", false); + _state["unittestsFailed"] = false; } if (!skip_normal_state.includes(props.question.type)) { - this.setPublicState("value", ""); + _state["value"] = ""; + } + + this.state = _state; + for (const [key, value] of Object.entries(_state)) { + this.props.public_state.set(key, value); } } |