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

To help you get started, we’ve selected a few @edtr-io/plugin 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 / plugins / solution-steps / src / index.ts View on Github external
import { child, object, list, Plugin, string, boolean } from '@edtr-io/plugin'
import { createIcon, faCheckSquare } from '@edtr-io/ui'

import { SolutionStepsEditor } from './editor'

export const solutionStep = object({
  type: string('step'),
  isHalf: boolean(),
  content: child('rows')
})

export const solutionStepsState = object({
  introduction: child('text'),
  strategy: child('rows'),
  hasStrategy: boolean(),
  solutionSteps: list(solutionStep),
  additionals: child('rows'),
  hasAdditionals: boolean()
})

export const solutionStepsPlugin: Plugin = {
  Component: SolutionStepsEditor,
  state: solutionStepsState,
  icon: createIcon(faCheckSquare),
  title: 'Lösungschritte',
  description: 'Erstelle mit diesem Plugin eine schrittweise Aufgabenlösung.'
}
github edtr-io / edtr-io / packages / plugins / files / src / index.tsx View on Github external
import { list, DeprecatedPlugin, upload } from '@edtr-io/plugin'
import { createIcon, faFileAlt } from '@edtr-io/ui'
import * as React from 'react'

import { createFilesEditor } from './editor'
import { FilesRenderer } from './renderer'
import { FileType, UploadedFile, UploadFileConfig } from './types'

export const fileState = list(
  upload({
    location: '',
    name: '',
    type: FileType.Other
  })
)

export function createFilePlugin(
  config: UploadFileConfig
): DeprecatedPlugin {
  const FilesEditor = createFilesEditor(config.upload)
  return {
    //eslint-disable-next-line react/display-name
    Component: props =>
      props.editable ? (