Skip to content

Commit

Permalink
replaced renderNode and renderMark documentations in slate-react with…
Browse files Browse the repository at this point in the history
… 0.22.0 changes (ianstormtaylor#2898)
  • Loading branch information
jorgeavaldez authored and ianstormtaylor committed Jul 3, 2019
1 parent 5222515 commit a0b2aa3
Showing 1 changed file with 54 additions and 10 deletions.
64 changes: 54 additions & 10 deletions docs/reference/slate-react/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ In addition to the [core plugin hooks](../slate/plugins.md), when using `slate-r
onPaste: Function,
onSelect: Function,
renderEditor: Function,
renderMark: Function,
renderNode: Function,
renderAnnotation: Function,
renderDecoration: Function,
renderBlock: Function,
renderInline: Function,
shouldNodeComponentUpdate: Function,
}
```
Expand Down Expand Up @@ -123,11 +125,11 @@ renderEditor: (props, editor, next) => {
}
```

### `renderMark`
### `renderDecoration`

`Function renderMark(props: Object, editor: Editor, next: Function) => ReactNode|Void`
`Function renderDecoration(props: Object, editor: Editor, next: Function) => ReactNode|Void`

Render a `Mark` with `props`. The `props` object contains:
Render a `Decoration` with `props`. The `props` object contains:

```js
{
Expand All @@ -142,13 +144,55 @@ Render a `Mark` with `props`. The `props` object contains:
}
```

You must spread the `props.attributes` onto the top-level DOM node you use to render the mark.
You must spread the `props.attributes` onto the top-level DOM node you use to render the annotation.

### `renderNode`
### `renderAnnotation`

`Function renderNode(props: Object, editor: Editor, next: Function) => ReactNode|Void`
`Function renderAnnotation(props: Object, editor: Editor, next: Function) => ReactNode|Void`

Render a `Node` with `props`. The `props` object contains:
Render an `Annotation` with `props`. The `props` object contains:

```js
{
attributes: Object,
children: ReactNode,
editor: Editor,
mark: Mark,
marks: Set<Mark>,
node: Node,
offset: Number,
text: String,
}
```

You must spread the `props.attributes` onto the top-level DOM node you use to render the annotation.

### `renderBlock`

`Function renderBlock(props: Object, editor: Editor, next: Function) => ReactNode|Void`

Render a Block `Node` with `props`. The `props` object contains:

```js
{
attributes: Object,
children: ReactNode,
editor: Editor,
isFocused: Boolean,
isSelected: BOolean,
node: Node,
parent: Node,
readOnly: Boolean,
}
```

You must spread the `props.attributes` onto the top-level DOM node you use to render the node. You must also be sure to assign `attributes.ref` to the native DOM component being rendered (using `forwardRef` or `innerRef` if necessary).

### `renderInline`

`Function renderInline(props: Object, editor: Editor, next: Function) => ReactNode|Void`

Render an Inline `Node` with `props`. The `props` object contains:

```js
{
Expand All @@ -163,7 +207,7 @@ Render a `Node` with `props`. The `props` object contains:
}
```

You must spread the `props.attributes` onto the top-level DOM node you use to render the node.
You must spread the `props.attributes` onto the top-level DOM node you use to render the node. You must also be sure to assign `attributes.ref` to the native DOM component being rendered (using `forwardRef` or `innerRef` if necessary).

### `shouldNodeComponentUpdate`

Expand Down

0 comments on commit a0b2aa3

Please sign in to comment.