1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-30 10:29:48 +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 ( return (
<Node <Node
key={node.key} key={node.key}
block={null}
node={node} node={node}
parent={state.document} parent={state.document}
schema={schema} schema={schema}

View File

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

View File

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