How to use the @edtr-io/core.StateType.list function in @edtr-io/core

To help you get started, we’ve selected a few @edtr-io/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github edtr-io / edtr-io / packages / plugin-input-exercise / src / index.ts View on Github external
import { StatefulPlugin, StateType } from '@edtr-io/core'

import { InputExerciseEditor } from './editor'
import { createIcon, faKeyboard } from '@edtr-io/editor-ui'

export const wrongAnswerObject = StateType.object({
  value: StateType.string(''),
  feedback: StateType.child()
})
export const inputExerciseState = StateType.object({
  type: StateType.string('Text'),
  correctAnswers: StateType.list(StateType.string('')),
  wrongAnswers: StateType.list(wrongAnswerObject)
})
export const inputExercisePlugin: StatefulPlugin = {
  Component: InputExerciseEditor,
  state: inputExerciseState,
  title: 'Eingabefeld',
  icon: createIcon(faKeyboard),
  description: 'Füge deiner Aufgabe ein Eingabefeld für die Lernenden hinzu.'
}
github edtr-io / edtr-io / packages / ui / src / plugin-rows / index.tsx View on Github external
import { StatefulPlugin, StateType } from '@edtr-io/core'

import { RowsPlugin } from './editor'

export const rowsState = StateType.list(StateType.child(), 1)

export const rowsPlugin: StatefulPlugin = {
  Component: RowsPlugin,
  state: rowsState
}
github edtr-io / edtr-io / packages / plugin-sc-mc-exercise / src / index.ts View on Github external
import { StateType, StatefulPlugin } from '@edtr-io/core'

import { ScMcExerciseEditor } from './editor'
import { createIcon, faDotCircle } from '@edtr-io/editor-ui'

export const AnswerProps = StateType.object({
  id: StateType.child(),
  isCorrect: StateType.boolean(false),
  feedback: StateType.child(),
  hasFeedback: StateType.boolean(false)
})

export const scMcState = StateType.object({
  isSingleChoice: StateType.boolean(false),
  answers: StateType.list(AnswerProps)
})

export const scMcExercisePlugin: StatefulPlugin = {
  Component: ScMcExerciseEditor,
  state: scMcState,
  icon: createIcon(faDotCircle),
  title: 'Auswahlaufgabe',
  description:
    'Füge deiner Aufgabe mehrere Single- oder Multiplechoice-Antworten hinzu.'
}
github edtr-io / edtr-io / packages / plugin-input-exercise / src / index.ts View on Github external
import { StatefulPlugin, StateType } from '@edtr-io/core'

import { InputExerciseEditor } from './editor'
import { createIcon, faKeyboard } from '@edtr-io/editor-ui'

export const wrongAnswerObject = StateType.object({
  value: StateType.string(''),
  feedback: StateType.child()
})
export const inputExerciseState = StateType.object({
  type: StateType.string('Text'),
  correctAnswers: StateType.list(StateType.string('')),
  wrongAnswers: StateType.list(wrongAnswerObject)
})
export const inputExercisePlugin: StatefulPlugin = {
  Component: InputExerciseEditor,
  state: inputExerciseState,
  title: 'Eingabefeld',
  icon: createIcon(faKeyboard),
  description: 'Füge deiner Aufgabe ein Eingabefeld für die Lernenden hinzu.'
}
github edtr-io / edtr-io / packages / plugin-rows / src / index.tsx View on Github external
import {
  StatefulPlugin,
  StatefulPluginEditorProps,
  StateType
} from '@edtr-io/core'
import * as React from 'react'

import { RowsEditor } from './editor'
import { RowsRenderer } from './renderer'
import { createPluginTheme } from '@edtr-io/ui'

export const rowState = StateType.child()
export const rowsState = StateType.list(rowState, 1)

const RowsPlugin = (props: StatefulPluginEditorProps) => {
  return props.editable ? (
    
  ) : (
    
  )
}

export const rowsPlugin: StatefulPlugin = {
  Component: RowsPlugin,
  state: rowsState,
  getFocusableChildren(state) {
    return state()
  }
}
github edtr-io / edtr-io / packages / plugin-equations / src / index.ts View on Github external
import { EquationsEditor } from './editor'
import { StateType, StatefulPlugin } from '@edtr-io/core'
import { createIcon, faEquals } from '@edtr-io/editor-ui'

export const StepProps = StateType.object({
  left: StateType.child(),
  right: StateType.child(),
  transform: StateType.child()
})

export const equationsState = StateType.object({
  steps: StateType.list(StepProps)
})

export const equationsPlugin: StatefulPlugin = {
  Component: EquationsEditor,
  state: equationsState,
  title: 'Gleichungen',
  description: 'Erzeuge einfach übersichtliche mathematische Gleichungen.',
  icon: createIcon(faEquals)
}

export * from './editor'