1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 18:09:49 +02:00

fix block warning for void nodes

This commit is contained in:
Ian Storm Taylor
2017-04-11 21:43:21 -07:00
parent 2f296972c0
commit 2b75499e60
3 changed files with 10 additions and 7 deletions

View File

@@ -878,6 +878,7 @@ class Content extends React.Component {
return (
<Node
key={node.key}
block={null}
node={node}
parent={state.document}
schema={schema}

View File

@@ -226,16 +226,17 @@ class Node extends React.Component {
*/
renderNode = (child) => {
const { block, editor, node, readOnly, schema, state } = this.props
return (
<Node
key={child.key}
node={child}
block={this.props.node.kind == 'block' ? this.props.node : this.props.block}
parent={this.props.node}
editor={this.props.editor}
readOnly={this.props.readOnly}
schema={this.props.schema}
state={this.props.state}
block={node.kind == 'block' ? node : block}
parent={node}
editor={editor}
readOnly={readOnly}
schema={schema}
state={state}
/>
)
}

View File

@@ -29,6 +29,7 @@ class Void extends React.Component {
*/
static propTypes = {
block: React.PropTypes.object,
children: React.PropTypes.any.isRequired,
editor: React.PropTypes.object.isRequired,
node: React.PropTypes.object.isRequired,
@@ -167,7 +168,7 @@ class Void extends React.Component {
return (
<Leaf
key={offsetKey}
block={block}
block={node.kind == 'block' ? node : block}
editor={editor}
index={index}
marks={marks}