1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-09-09 06:30:40 +02:00

add editor className and style properties

This commit is contained in:
Ian Storm Taylor
2016-07-11 19:28:35 -07:00
parent cc18b6a184
commit 56cc6101d9
3 changed files with 52 additions and 12 deletions

View File

@@ -8,12 +8,15 @@ import { Editor } from 'slate'
The top-level React component that renders the Slate editor itself.
- [Properties](#properties)
- [`className`](#classname-string)
- [`onChange`](#onchange-function)
- [`plugins`](#plugins-array)
- [`state`](#state-state)
- [`style`](#style-object)
- [Placeholder Properties](#placeholder-properties)
- [`placeholder`](#placeholder-text-or-element)
- [`placeholderClassName`](#placeholderclassname-string)
- [`placeholderStyle`](#placeholderstyle-string)
- [`plugins`](#plugins-array)
- [`state`](#state-state)
- [Plugin-like Properties](#plugin-like-properties)
- [`onBeforeInput`](#onbeforeinput-function)
- [`onKeyDown`](#onkeydown-function)
@@ -30,16 +33,45 @@ The top-level React component that renders the Slate editor itself.
```js
<Editor
className={string}
onChange={Function}
plugins={Array}
state={State}
style={Object}
/>
```
#### `className: String`
An optional class name to apply to the content editable element.
#### `onChange: Function`
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 hook allows you to add persistence logic to your editor.
#### `plugins: Array`
An array of [`Plugins`](../plugins) that define the editor's behavior.
#### `state: State`
A [`State`](../models/state) object representing the current state of the editor.
#### `style: Object`
An optional dictionary of styles to apply to the content editable element.
## Placeholder Properties
```js
<Editor
placeholder={Any}
placeholderClassName={string}
placeholderStyle={Object}
/>
```
#### `placeholder: Text or Element`
A placeholder string (or React element) that will be rendered as the default block type's placeholder.
@@ -52,14 +84,6 @@ An optional class name to apply to the default block type's placeholder.
An optional dictionary of styles to apply to the default block type's placeholder. If `placeholder` is a string, and no class name or style dictionary is passed, this property will default to `{ opacity: '0.333' }`.
#### `plugins: Array`
An array of [`Plugins`](../plugins) that define the editor's behavior.
#### `state: State`
A [`State`](../models/state) object representing the current state of the editor.
## Plugin-like Properties