mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-07-31 20:40:19 +02:00
update docs
This commit is contained in:
@@ -31,6 +31,12 @@ These properties are actually an implicit plugin defintion. Internally, they are
|
|||||||
|
|
||||||
### Properties
|
### Properties
|
||||||
|
|
||||||
|
#### `onChange(state)`
|
||||||
|
|
||||||
|
A change handler that will be called with the newly-changed editor `state`. You should usually pass the newly changed `state` back into the editor through its `state` property.
|
||||||
|
|
||||||
|
This is how you can add persistence logic to your editor.
|
||||||
|
|
||||||
#### `plugins`
|
#### `plugins`
|
||||||
|
|
||||||
An array of [`Plugins`](../plugins) that define the editor's behavior.
|
An array of [`Plugins`](../plugins) that define the editor's behavior.
|
||||||
@@ -43,15 +49,13 @@ A [`State`](../models/state) object representing the current state of the editor
|
|||||||
|
|
||||||
All of the other properties of the editor are equivalent to the properties of a [`Plugin`](../plugins).
|
All of the other properties of the editor are equivalent to the properties of a [`Plugin`](../plugins).
|
||||||
|
|
||||||
They are convenience properties, such that passing any of them will be treated equivalently to passing them on the first plugin in the stack with those properties.
|
They are convenience properties, treated equivalently to passing them as the first plugin in the plugin stack. For example:
|
||||||
|
|
||||||
For example:
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const plugins = [somePlugin]
|
const plugins = [somePlugin]
|
||||||
|
|
||||||
<Editor
|
<Editor
|
||||||
onChange={myOnChangeHandler}
|
onKeyDown={myKeyHandler}
|
||||||
plugins={plugins}
|
plugins={plugins}
|
||||||
state={state}
|
state={state}
|
||||||
/>
|
/>
|
||||||
@@ -61,7 +65,7 @@ Is equivalent to passing an additional, first-priority plugin, like:
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
const editorPlugin = {
|
const editorPlugin = {
|
||||||
onChange: myOnChangeHandler
|
onKeyDown: myKeyHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
const plugins = [
|
const plugins = [
|
||||||
|
Reference in New Issue
Block a user