message: Refactor packages/plugins/input-exercise/src/editor.tsx
diff: @@ -41,14 +41,12 @@ export function InputExerciseEditor(props: InputExerciseProps) {
  props.state.answers.map((answer) => answer.feedback.id)
  )
  const [previewActive, setPreviewActive] = React.useState(false)
  - return (
  - <React.Fragment>
  - {editable ? (
  + return editable ? (
  <React.Fragment>
  <PreviewOverlay focused={nestedFocus} onChange={setPreviewActive}>
  <InputExerciseRenderer {...props} />
  </PreviewOverlay>
  - {nestedFocus && !previewActive ? (
  + {nestedFocus && !previewActive && (
  <React.Fragment>
  {state.answers.map((answer, index: number) => {
  return (
  @@ -68,12 +66,10 @@ export function InputExerciseEditor(props: InputExerciseProps) {
  feedback={answer.feedback.render()}
  feedbackID={answer.feedback.id}
  isActive={answer.isCorrect.value}
  - handleChange={() => {
  + handleChange={() =>
  answer.isCorrect.set(!answer.isCorrect.value)
  - }}
  - remove={() => {
  - state.answers.remove(index)
  - }}
  + }
  + remove={() => state.answers.remove(index)}
  focusedElement={focusedElement || undefined}
  />
  )
  @@ -82,15 +78,13 @@ export function InputExerciseEditor(props: InputExerciseProps) {
  {i18n.answer.addLabel}
  </AddButton>
  </React.Fragment>
  - ) : null}
  + )}
  {props.renderIntoSettings(
  <React.Fragment>
  <OverlayInput
  label={i18n.unit.label}
  value={state.unit.value}
  - onChange={(e) => {
  - state.unit.set(e.target.value)
  - }}
  + onChange={(e) => state.unit.set(e.target.value)}
  />
  <OverlaySelect
  label={i18n.type.label}
  @@ -99,9 +93,7 @@ export function InputExerciseEditor(props: InputExerciseProps) {
  }}
  value={translateDataType(state.type.value as InputExerciseType)}
  options={R.values(
  - R.mapObjIndexed((type) => {
  - return translateDataType(type)
  - }, InputExerciseType)
  + R.mapObjIndexed(translateDataType, InputExerciseType)
  )}
  />
  </React.Fragment>
  @@ -109,7 +101,5 @@ export function InputExerciseEditor(props: InputExerciseProps) {
  </React.Fragment>
  ) : (
  <InputExerciseRenderer {...props} />
  - )}
  - </React.Fragment>
  )
  }
  