mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-29 01:50:06 +02:00
Replace renderNode with renderBlock (#2762)
This commit is contained in:
committed by
Ian Storm Taylor
parent
376015df6c
commit
f76a00acdc
@@ -89,18 +89,18 @@ class App extends React.Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
// Pass in the `renderNode` prop...
|
||||
// Pass in the `renderBlock` prop...
|
||||
<Editor
|
||||
value={this.state.value}
|
||||
onChange={this.onChange}
|
||||
onKeyDown={this.onKeyDown}
|
||||
renderNode={this.renderNode}
|
||||
renderBlock={this.renderBlock}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
// Add a `renderNode` method to render a `CodeNode` for code blocks.
|
||||
renderNode = (props, editor, next) => {
|
||||
// Add a `renderBlock` method to render a `CodeNode` for code blocks.
|
||||
renderBlock = (props, editor, next) => {
|
||||
switch (props.node.type) {
|
||||
case 'code':
|
||||
return <CodeNode {...props} />
|
||||
@@ -148,12 +148,12 @@ class App extends React.Component {
|
||||
value={this.state.value}
|
||||
onChange={this.onChange}
|
||||
onKeyDown={this.onKeyDown}
|
||||
renderNode={this.renderNode}
|
||||
renderBlock={this.renderBlock}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
renderNode = (props, editor, next) => {
|
||||
renderBlock = (props, editor, next) => {
|
||||
switch (props.node.type) {
|
||||
case 'code':
|
||||
return <CodeNode {...props} />
|
||||
@@ -206,12 +206,12 @@ class App extends React.Component {
|
||||
value={this.state.value}
|
||||
onChange={this.onChange}
|
||||
onKeyDown={this.onKeyDown}
|
||||
renderNode={this.renderNode}
|
||||
renderBlock={this.renderBlock}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
renderNode = (props, editor, next) => {
|
||||
renderBlock = (props, editor, next) => {
|
||||
switch (props.node.type) {
|
||||
case 'code':
|
||||
return <CodeNode {...props} />
|
||||
|
Reference in New Issue
Block a user