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

Replace renderNode with renderBlock (#2762)

This commit is contained in:
Matthew Steedman
2019-05-11 21:52:09 -04:00
committed by Ian Storm Taylor
parent 376015df6c
commit f76a00acdc

View File

@@ -89,18 +89,18 @@ class App extends React.Component {
render() { render() {
return ( return (
// Pass in the `renderNode` prop... // Pass in the `renderBlock` prop...
<Editor <Editor
value={this.state.value} value={this.state.value}
onChange={this.onChange} onChange={this.onChange}
onKeyDown={this.onKeyDown} onKeyDown={this.onKeyDown}
renderNode={this.renderNode} renderBlock={this.renderBlock}
/> />
) )
} }
// Add a `renderNode` method to render a `CodeNode` for code blocks. // Add a `renderBlock` method to render a `CodeNode` for code blocks.
renderNode = (props, editor, next) => { renderBlock = (props, editor, next) => {
switch (props.node.type) { switch (props.node.type) {
case 'code': case 'code':
return <CodeNode {...props} /> return <CodeNode {...props} />
@@ -148,12 +148,12 @@ class App extends React.Component {
value={this.state.value} value={this.state.value}
onChange={this.onChange} onChange={this.onChange}
onKeyDown={this.onKeyDown} onKeyDown={this.onKeyDown}
renderNode={this.renderNode} renderBlock={this.renderBlock}
/> />
) )
} }
renderNode = (props, editor, next) => { renderBlock = (props, editor, next) => {
switch (props.node.type) { switch (props.node.type) {
case 'code': case 'code':
return <CodeNode {...props} /> return <CodeNode {...props} />
@@ -206,12 +206,12 @@ class App extends React.Component {
value={this.state.value} value={this.state.value}
onChange={this.onChange} onChange={this.onChange}
onKeyDown={this.onKeyDown} onKeyDown={this.onKeyDown}
renderNode={this.renderNode} renderBlock={this.renderBlock}
/> />
) )
} }
renderNode = (props, editor, next) => { renderBlock = (props, editor, next) => {
switch (props.node.type) { switch (props.node.type) {
case 'code': case 'code':
return <CodeNode {...props} /> return <CodeNode {...props} />