mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-24 09:13:24 +01:00
replaced renderNode and renderMark documentations in slate-react with 0.22.0 changes (#2898)
This commit is contained in:
parent
5222515c0c
commit
a0b2aa3d4f
@ -22,8 +22,10 @@ In addition to the [core plugin hooks](../slate/plugins.md), when using `slate-r
|
|||||||
onPaste: Function,
|
onPaste: Function,
|
||||||
onSelect: Function,
|
onSelect: Function,
|
||||||
renderEditor: Function,
|
renderEditor: Function,
|
||||||
renderMark: Function,
|
renderAnnotation: Function,
|
||||||
renderNode: Function,
|
renderDecoration: Function,
|
||||||
|
renderBlock: Function,
|
||||||
|
renderInline: Function,
|
||||||
shouldNodeComponentUpdate: Function,
|
shouldNodeComponentUpdate: Function,
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -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
|
```js
|
||||||
{
|
{
|
||||||
@ -142,13 +144,34 @@ 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
|
```js
|
||||||
{
|
{
|
||||||
@ -163,7 +186,28 @@ 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).
|
||||||
|
|
||||||
|
### `renderInline`
|
||||||
|
|
||||||
|
`Function renderInline(props: Object, editor: Editor, next: Function) => ReactNode|Void`
|
||||||
|
|
||||||
|
Render an Inline `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).
|
||||||
|
|
||||||
### `shouldNodeComponentUpdate`
|
### `shouldNodeComponentUpdate`
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user