How to use the @edtr-io/editor-ui.createIcon function in @edtr-io/editor-ui

To help you get started, we’ve selected a few @edtr-io/editor-ui 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-video / src / index.tsx View on Github external
import { StatefulPlugin, StateType } from '@edtr-io/core'
import * as React from 'react'

import { VideoEditor } from './editor'
import { VideoRenderer } from './renderer'
import { createIcon, faFilm } from '@edtr-io/editor-ui'

export const videoState = StateType.string()
export const videoPlugin: StatefulPlugin = {
  //eslint-disable-next-line react/display-name
  Component: props =>
    props.editable ?  : ,
  state: videoState,
  title: 'Video',
  description: 'Binde Videos von Youtube, Vimeo, Wikimedia und BR ein.',
  icon: createIcon(faFilm),
  onPaste(clipboardData: DataTransfer) {
    const value = clipboardData.getData('text')

    const regex = /^(https?:\/\/)?(.*?(youtube\.com\/watch\?(.*&)?v=.+|youtu\.be\/.+|vimeo\.com\/.+|upload\.wikimedia\.org\/.+(\.webm|\.ogg)?|br\.de\/.+))/
    if (regex.test(value)) {
      return { state: value }
    }
  }
}
github edtr-io / edtr-io / packages / plugin-spoiler / src / index.ts View on Github external
import { StatefulPlugin, StateType } from '@edtr-io/core'

import { SpoilerEditor } from './editor'
import { createIcon, faCaretSquareDown } from '@edtr-io/editor-ui'

export const spoilerState = StateType.object({
  title: StateType.string(''),
  content: StateType.child('rows')
})

export const spoilerPlugin: StatefulPlugin = {
  Component: SpoilerEditor,
  state: spoilerState,
  icon: createIcon(faCaretSquareDown),
  title: 'Spoiler',
  description:
    'In diese ausklappbaren Box kannst du zum Beispiel Exkurse hinzufügen.'
}

export interface SpoilerTheme {
  color: string
}
github edtr-io / edtr-io / packages / plugin-hint / src / index.ts View on Github external
import { StatefulPlugin, StateType } from '@edtr-io/core'

import { HintEditor } from './editor'
import { createIcon, faLightbulb } from '@edtr-io/editor-ui'

export const hintState = StateType.object({
  title: StateType.string(''),
  content: StateType.child('rows')
})

export const hintPlugin: StatefulPlugin = {
  Component: HintEditor,
  state: hintState,
  title: 'Hinweis',
  description: 'Gib zusätzliche Tipps zur Aufgabe in dieser ausklappbaren Box.',
  icon: createIcon(faLightbulb)
}
github edtr-io / edtr-io / packages / plugin-sc-mc-exercise / src / index.ts View on Github external
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-solution / src / index.ts View on Github external
import { StatefulPlugin, StateType } from '@edtr-io/core'

import { SolutionEditor } from './editor'
import { createIcon, faCheckSquare } from '@edtr-io/editor-ui'

export const solutionState = StateType.object({
  title: StateType.string(''),
  content: StateType.child('rows')
})

export const solutionPlugin: StatefulPlugin = {
  Component: SolutionEditor,
  state: solutionState,
  icon: createIcon(faCheckSquare),
  title: 'Lösung',
  description:
    'Gestalte in dieser ausklappbaren Box eine ausführliche Lösung zu deinen Aufgaben.'
}
github edtr-io / edtr-io / packages / plugin-anchor / src / index.ts View on Github external
import { StatefulPlugin, StateType } from '@edtr-io/core'

import { AnchorEditor } from './editor'
import { faAnchor, createIcon } from '@edtr-io/editor-ui'

export const anchorState = StateType.string()

export const anchorPlugin: StatefulPlugin = {
  Component: AnchorEditor,
  state: anchorState,
  title: 'Anker',
  description: 'Füge eine Sprungmarke innerhalb deines Inhalts hinzu.',
  icon: createIcon(faAnchor)
}
github edtr-io / edtr-io / packages / plugin-highlight / src / index.ts View on Github external
export function createHighlightPlugin(config: HighlightPluginConfig) : StatefulPlugin {
  return {
    Component: createHighlightEditor(config),
    state: highlightState,
    title: 'Code',
    description:
      'Schreibe Code und lasse ihn je nach Programmiersprache highlighten.',
    icon: createIcon(faCode)
  }
}
github edtr-io / edtr-io / packages / plugin-input-exercise / src / index.ts View on Github external
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-highlight / src / editor.tsx View on Github external
export function createHighlightPlugin(config: HighlightPluginConfig) : StatefulPlugin {
  return {
    Component: createHighlightEditor(config),
    state: highlightState,
    title: 'Code',
    description:
      'Schreibe Code und lasse ihn je nach Programmiersprache highlighten.',
    icon: createIcon(faCode)
  }
}
github edtr-io / edtr-io / packages / plugin-equations / src / index.ts View on Github external
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'