1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-24 01:02:31 +01:00
Ian Storm Taylor a7dd173dea update docs
2016-07-11 13:22:41 -07:00

1.0 KiB

<Editor>

The top-level React component that renders the Slate editor itself.

<Editor
  plugins={Array}
  state={State}
/>

The editor takes a State instance that contains it's content and selection, and an array of plugins that define its behavior.

In addition to those two properties, the editor allows passing any of the properties that a plugin can define:

<Editor
  onBeforeInput={Function}
  onChange={Function}
  onKeyDown={Function}
  onPaste={Function}
  plugins={Array}
  renderDecorations={Function}
  renderMark={Function}
  renderNode={Function}
  state={State}
/>

These properties are actually an implicit plugin defintion. Internally, they are grouped together and turned into a plugin that is given first priority in the plugin stack.

Properties

onChange(state, editor)

A handler that's called every time the editor's state changes. It is called with the newly changed state and the editor instance itself.

Methods

getState()

Return the editor's current internal state.